Skip to content

Space in path causes ClassParse to fail #8049

@HermanEldering

Description

@HermanEldering

Description

When trying to compile a Jar project for Android the compilation fails when the path contains a space. It gives the following output:

1>Building target "_ExportJarToXml" completely.
1>Output file "<mypath>\Release\api.xml" does not exist.
1>Using "ClassParse" task from assembly "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
1>Task "ClassParse"
1>  Using: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\class-parse.exe
1>  [class-parse] response file: <mypath>\Release\class-parse.rsp
1>  --o="<mypath>\Release\api.xml.class-parse"
1>  "Jars\IOIOLibCore-5.07.jar"
1>  C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\class-parse.exe @<mypath>\Release\class-parse.rsp 
1>  
1>  Unhandled Exception: System.IO.FileNotFoundException: Could not find file '<my path left of first space>'.
1>     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1>     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1>     at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
1>     at System.IO.StreamReader..ctor(String path)
1>     at System.IO.File.OpenText(String path)
1>     at Mono.Options.ResponseFileSource.GetArguments(String value, IEnumerable`1& replacement) in D:\a\1\s\XPlat\Mono.Options\externals\Options.cs:line 718
1>     at Mono.Options.OptionSet.AddSource(ArgumentEnumerator ae, String argument) in D:\a\1\s\XPlat\Mono.Options\externals\Options.cs:line 1094
1>     at Mono.Options.OptionSet.Parse(IEnumerable`1 arguments) in D:\a\1\s\XPlat\Mono.Options\externals\Options.cs:line 1050
1>     at Xamarin.Android.Tools.App.Main(String[] args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/class-parse/Program.cs:line 61
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "class-parse.exe" exited with code -532462766.
1>Done executing task "ClassParse" -- FAILED.
1>Done building target "_ExportJarToXml" in project "IOIOLibJar.csproj" -- FAILED.

If I run the command given below from the project directory then it doesn't show an error message, and a api.xml.class-parse exists in the obj folder. Note the added quotes for the command line parameter.

"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\class-parse.exe" "@<mypath>\Release\class-parse.rsp"

Unfortunately, running this command manually does not enable building because the xml file needs to be processed to generate api.xml.

Steps to Reproduce

  1. Copy a jar project to a directory which contains a space in the path.
  2. Rebuild the project with Visual Studio

Visual Studio version 17.3 Preview 1.1
.NET 6.0.301

Version with bug

Unknown/Other (please specify)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android (All)

Did you find any workaround?

No response

Relevant log output

1>Building target "_ExportJarToXml" completely.
1>Output file "<mypath>\Release\api.xml" does not exist.
1>Using "ClassParse" task from assembly "C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\Xamarin.Android.Build.Tasks.dll".
1>Task "ClassParse"
1>  Using: C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\class-parse.exe
1>  [class-parse] response file: <mypath>\Release\class-parse.rsp
1>  --o="<mypath>\Release\api.xml.class-parse"
1>  "Jars\IOIOLibCore-5.07.jar"
1>  C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\class-parse.exe @<mypath>\Release\class-parse.rsp 
1>  
1>  Unhandled Exception: System.IO.FileNotFoundException: Could not find file '<my path left of first space>'.
1>     at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>     at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1>     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
1>     at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
1>     at System.IO.StreamReader..ctor(String path)
1>     at System.IO.File.OpenText(String path)
1>     at Mono.Options.ResponseFileSource.GetArguments(String value, IEnumerable`1& replacement) in D:\a\1\s\XPlat\Mono.Options\externals\Options.cs:line 718
1>     at Mono.Options.OptionSet.AddSource(ArgumentEnumerator ae, String argument) in D:\a\1\s\XPlat\Mono.Options\externals\Options.cs:line 1094
1>     at Mono.Options.OptionSet.Parse(IEnumerable`1 arguments) in D:\a\1\s\XPlat\Mono.Options\externals\Options.cs:line 1050
1>     at Xamarin.Android.Tools.App.Main(String[] args) in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/tools/class-parse/Program.cs:line 61
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Xamarin\Android\Xamarin.Android.Bindings.ClassParse.targets(30,5): error MSB6006: "class-parse.exe" exited with code -532462766.
1>Done executing task "ClassParse" -- FAILED.
1>Done building target "_ExportJarToXml" in project "IOIOLibJar.csproj" -- FAILED.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-toolingXAML & C# Hot Reload, XAML Editor, Live Visual Tree, Live Preview, Debuggingplatform/androids/try-latest-versionPlease try to reproduce the potential issue on the latest public versiont/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions