-
Notifications
You must be signed in to change notification settings - Fork 516
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
System.IO.FileNotFoundException: Could not load the file 'System.Runtime.CompilerServices.Unsafe' #9266
Comments
Possibly related to: |
A sample project is really necessary here. |
We have not received the requested information. If you are still experiencing this issue please provide all the requested information then click the Reopen Issue button. Thanks! |
@whitneyschmidt Can you reopen the issue? It seems I can reproduce it quite easily. Application will start only if I remove <PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0" /> and uses of types from that assembly.
Bundle contains assembly System.Runtime.CompilerServices.Unsafe.dll, but it's a reference assembly
Visual Studio for Mac:
|
Thanks for following up on this issue! cc @dalexsoto for further investigation |
I can reproduce and a fix is in progress. |
…ce assemblies as well. The build logic will put reference assemblies in 'ResolvedCompileFileDefinitions' instead of '_ReferencesFromNuGetPackages' when using the new-style packageref format, so we need to handle 'ResolvedCompileFileDefinitions' the same way we handle '_ReferencesFromNuGetPackages'. I was unfortunately not able to create a unit test for this scenario, because xibuild sets MSBUILD_EXE_PATH to make msbuild look in our local build files, and then the restore fails with: > Issue9266.csproj : error MSB4236: The SDK 'Msbuild.Sdk.Extras/2.1.2' specified could not be found. If I don't use "Msbuild.Sdk.Extras" in the test, then it doesn't hit the broken path this PR is fixing. If I change xibuild to not set MSBUILD_EXE_PATH, we're not testing our local bits anymore, but the system Xamarin.Mac. Fixes xamarin#9266.
…ce assemblies as well. (#10197) The build logic will put reference assemblies in 'ResolvedCompileFileDefinitions' instead of '_ReferencesFromNuGetPackages' when using the new-style packageref format, so we need to handle 'ResolvedCompileFileDefinitions' the same way we handle '_ReferencesFromNuGetPackages'. I was unfortunately not able to create a unit test for this scenario, because xibuild sets MSBUILD_EXE_PATH to make msbuild look in our local build files, and then the restore fails with: > Issue9266.csproj : error MSB4236: The SDK 'Msbuild.Sdk.Extras/2.1.2' specified could not be found. If I don't use "Msbuild.Sdk.Extras" in the test, then it doesn't hit the broken path this PR is fixing. If I change xibuild to not set MSBUILD_EXE_PATH, we're not testing our local bits anymore, but the system Xamarin.Mac. Fixes #9266.
Steps to Reproduce
TODO: I will fill this out in more detail.
In my case I'm converting a Xamarin.Mac project to the sdk-style project format. So, after I've uploaded a sample project, the repro step will be to build and run it.
Expected Behavior
Project runs and shows the window.
Actual Behavior
Xamarin.Mac project crashes with the following exception:
The mac host app references a shared .net standard 2.0 library, which references System.Memory, which in turn references System.Runtime.CompilerServices.Unsafe. I have verified that System.Runtime.CompilerServices.Unsafe.dll is present in the output directory (and the application bundle), but that it's actually the reference assembly and not the implementation assembly (i.e. the one found in the ref/ folder of the package). I checked this by comparing the assemblies' hashes. If I manually replace the dll with the correct one from the lib/ folder, and the exception went away (it was replaced by a similar issue with a different assembly, but that's a separate problem).
Environment
The text was updated successfully, but these errors were encountered: