Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to run an Ooui.Xaml project from VS4Mac when XAML present #257

Open
alexeystrakh opened this issue May 19, 2021 · 3 comments
Open

Comments

@alexeystrakh
Copy link

My Ooui.Xaml project can run and render a Xamarin.Forms page defined in code. But when I switch to a xaml file to define my UI, I'm getting the following error. If I restart the VS, it works once but then the next build fails again:

/Users/astrakh/.nuget/packages/xamarin.forms/5.0.0.2012/buildTransitive/Xamarin.Forms.targets(3,3): Error MSB4018: The "XamlCTask" task failed unexpectedly.
System.IO.IOException: Sharing violation on path /Users/astrakh/Desktop/Sources/ooui-samples/ooui-wasm/obj/Debug/net6.0/ooui-wasm.dll


Server stack trace: 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2020-02/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:91 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00006] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00008] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 
  at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <02cd44f94ebd4355b3be9e1dbd9d77a1>:0 
  at Xamarin.Forms.Build.Tasks.XamlCTask.Execute (System.Collections.Generic.IList`1[System.Exception]& thrownExceptions) [0x001ba] in <61d3a1815aec4afe953f16fc8b420ef0>:0 
  at Xamarin.Forms.Build.Tasks.XamlTask.Execute () [0x00000] in <61d3a1815aec4afe953f16fc8b420ef0>:0 
  at (wrapper remoting-invoke-with-check) Xamarin.Forms.Build.Tasks.XamlTask.Execute()
  at (wrapper xdomain-dispatch) Xamarin.Forms.Build.Tasks.XamlTask.Execute(object,byte[]&,byte[]&)

Exception rethrown at [0]: 
  at (wrapper xdomain-invoke) Xamarin.Forms.Build.Tasks.XamlTask.Execute()
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00023] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/TaskExecutionHost/TaskExecutionHost.cs:577 
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002b9] in /Users/builder/jenkins/workspace/build-package-osx-mono-pullrequest/pr/external/bockbuild/builds/msbuild-15/src/Build/BackEnd/Components/RequestBuilder/TaskBuilder.cs:809  (MSB4018) (ooui-wasm)
@alexeystrakh
Copy link
Author

And if you run via dotnet CLI, another error appears (only if xaml page is present and InitializeComponent is called from the constructor):

dotnet run --project ooui-wasm.csproj
/Users/astrakh/.nuget/packages/ooui.wasm/0.14.16/build/netstandard2.0/Ooui.Wasm.targets(17,3): error : Linker failed to resolve method System.Void System.CodeDom.Compiler.GeneratedCodeAttribute::.ctor(System.String,System.String) [/Users/astrakh/Desktop/Sources/ooui-samples/ooui-wasm/ooui-wasm.csproj]
/Users/astrakh/.nuget/packages/ooui.wasm/0.14.16/build/netstandard2.0/Ooui.Wasm.targets(17,3): error : Linker failed to resolve type System.CodeDom.Compiler.GeneratedCodeAttribute in System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a [/Users/astrakh/Desktop/Sources/ooui-samples/ooui-wasm/ooui-wasm.csproj]

@F-Goncalves
Copy link

Same here.
Did you manage resolve this issue?

@F-Goncalves
Copy link

Nevermind. I noticed that my application was targeting .net5.0 instead of .netcore.
So I changed the TargetFramework to netcoreapp3.1 and could run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants