-
Notifications
You must be signed in to change notification settings - Fork 128
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
Linker fails when adding a TrimmerRootAssembly #853
Comments
try and add the following to your csprj file |
Running into the same issue in a netcoreapp3.1 when publishing with
Setting |
did this issue got solved? i'm having the same issue with blazor wasm publish, following is my blazor wasm project csproj file (its just a test using default template)
what am i doing wrong here? |
@aloksharma1 your problem is a duplicate of #1772 which will be addressed in .NET6 P3. The original issue will be addressed as part of dotnet/runtime#43078 |
Transfer of dotnet/runtime#733 (comment)
When using PublishTrimmed=true for publishing single file applications in .net core, I get a runtime error when performing binary serialization/deserialization in System.Runtime.Serialization.Formatters library.
Exe netcoreapp3.0 true true true true win-x64 win-x64;linux-x64 The error during runtime received is:System.TypeInitializationException: The type initializer for 'System.Runtime.Serialization.Formatters.Binary.Converter' threw an exception.
---> System.IO.FileNotFoundException: Could not load file or assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The system cannot find the file specified.
File name: 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, RuntimeAssembly assemblyContext, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext)
at System.Reflection.Assembly.Load(String assemblyString)
at System.Runtime.Serialization.Formatters.Binary.Converter..cctor()
--- End of inner exception stack trace ---
but that prevents it from publishing as it returns an error: C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.ILLink.targets(87,5): error MSB6006: "dotnet.exe" exited with code -1073741819.at System.Runtime.Serialization.Formatters.Binary.BinaryParser.get_SystemAssemblyInfo()
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(BinaryParser serParser, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, Boolean check)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream)
I also tried adding the following to address this error:
I can disable PublishTrimmed=true for now, but I would think there's a way to address this.
The application is a .Net Core 3 app, which references two multi-target libraries which are netstandard2.0;net462
The text was updated successfully, but these errors were encountered: