Blazor Preview 7 Linker error
See original GitHub issueHaving updated my Blazor client solution from preview 6 to preview 7 followed this guidance doing a dotnet build
results in the following linker error where it is unable to find System.Text.Json.Serialization.JsonSerializerOptions
:
Hub.Platform.Client -> C:\Users\DarrellTunnell\source\repos\HubCore\src\Hub.Platform\Hub.Platform.Client\bin\Debug\netstandard2.0\Hub.Platform.Client.dll Processing embedded resource linker descriptor: mscorlib.xml Duplicate preserve in resource mscorlib.xml in mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e of System.Threading.WasmRuntime (All). Duplicate uses (All) Type System.Reflection.Assembly has no fields to preserve Fatal error in IL Linker
Unhandled Exception: Mono.Cecil.ResolutionException: Failed to resolve System.Text.Json.Serialization.JsonSerializerOptions at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference) at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference) at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference) at Mono.Linker.Steps.MarkStep.InitializeFields(TypeDefinition type) at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type) at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly) at Mono.Linker.Steps.MarkStep.Initialize() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step) at Mono.Linker.Pipeline.Process(LinkContext context) at Mono.Linker.Driver.Run(ILogger customLogger) at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger) at Mono.Linker.Driver.Main(String[] args) C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview7.19365.7\targets\Blazor.MonoRuntime.targets(439,5): error MSB3073: The command “dotnet “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.blazor.mono\0.10.0-preview7.19351.1\build\netstandard1.0../…/tools/illink/illink.dll” -l none --disable-opt unreachablebodies --verbose --strip-security true --exclude-feature com --exclude-feature sre -v false -c link -u link -b true -d “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.blazor.mono\0.10.0-preview7.19351.1\build\netstandard1.0../…/tools/mono/bcl/” -d “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.blazor.mono\0.10.0-preview7.19351.1\build\netstandard1.0../…/tools/mono/bcl/Facades/” -o “C:\Users\DarrellTunnell\source\repos\HubCore\src\Hub.Platform\Hub.Platform.Client\obj\Debug\netstandard2.0\blazor\linker/” -x “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.blazor.build\3.0.0-preview7.19365.7\targets\BuiltInBclLinkerDescriptor.xml” -x “C:\Users\DarrellTunnell\source\repos\HubCore\src\Hub.Platform\Hub.Platform.Client\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml” -a “C:\Users\DarrellTunnell.nuget\packages\blazorsignalr\0.7.0-blazor-3.0.0-preview6.19307.2\lib\netstandard2.0\BlazorSignalR.JS.dll” -a “C:\Users\DarrellTunnell.nuget\packages\blazorsignalr\0.7.0-blazor-3.0.0-preview6.19307.2\lib\netstandard2.0\BlazorSignalR.dll” -a “C:\Users\DarrellTunnell.nuget\packages\lazycache\2.0.1\lib\netstandard2.0\LazyCache.dll” -a “C:\Users\DarrellTunnell.nuget\packages\lazycache.aspnetcore\2.0.1\lib\netstandard2.0\LazyCache.AspNetCore.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.authorization\3.0.0-preview7.19365.7\lib\netstandard2.0\Microsoft.AspNetCore.Authorization.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.blazor\3.0.0-preview7.19365.7\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.components\3.0.0-preview7.19365.7\lib\netstandard2.0\Microsoft.AspNetCore.Components.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.components.browser\3.0.0-preview7.19365.7\lib\netstandard2.0\Microsoft.AspNetCore.Components.Browser.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.connections.abstractions\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.http.connections.client\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.Http.Connections.Client.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.http.connections.common\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.Http.Connections.Common.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.http.features\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.metadata\3.0.0-preview7.19365.7\lib\netstandard2.0\Microsoft.AspNetCore.Metadata.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.signalr.client\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Client.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.signalr.client.core\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Client.Core.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.signalr.common\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Common.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.aspnetcore.signalr.protocols.json\3.0.0-preview6.19307.2\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Protocols.Json.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.bcl.asyncinterfaces\1.0.0-preview7.19362.9\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.caching.abstractions\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Caching.Abstractions.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.caching.memory\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Caching.Memory.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.configuration\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.configuration.abstractions\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.configuration.binder\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.dependencyinjection\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.http\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Http.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.logging\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Logging.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.logging.abstractions\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.options\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Options.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.extensions.primitives\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll” -a “C:\Users\DarrellTunnell.nuget\packages\microsoft.jsinterop\3.0.0-preview7.19362.4\lib\netstandard2.0\Microsoft.JSInterop.dll” -a “C:\Users\DarrellTunnell.nuget\packages\mono.webassembly.interop\3.0.0-preview7.19362.4\lib\netstandard2.0\Mono.WebAssembly.Interop.dll” -a “C:\Users\DarrellTunnell.nuget\packages\netpack.browserreload.blazorclient\0.3.0-alpha0108\lib\netstandard2.0\NetPack.BrowserReload.BlazorClient.dll” -a “C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.buffers\4.5.0\lib\netstandard2.0\System.Buffers.dll” -a “C:\Users\DarrellTunnell.nuget\packages\system.componentmodel.annotations\4.6.0-preview7.19362.9\lib\netstandard2.0\System.ComponentModel.Annotations.dll” -a “C:\Users\DarrellTunnell.nuget\packages\system.io.pipelines\4.6.0-preview6.19303.8\lib\netstandard2.0\System.IO.Pipelines.dll” -a “C:\Users\DarrellTunnell.nuget\packages\system.memory\4.5.3\lib\netstandard2.0\System.Memory.dll” -a “C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.numerics.vectors\4.5.0\lib\netstandard2.0\System.Numerics.Vectors.dll” -a “C:\Users\DarrellTunnell.nuget\packages\system.runtime.compilerservices.unsafe\4.6.0-preview7.19362.9\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll” -a “C:\Users\DarrellTunnell.nuget\packages\system.text.json\4.6.0-preview7.19362.9\lib\netstandard2.0\System.Text.Json.dll” -a “C:\Users\DarrellTunnell.nuget\packages\system.threading.channels\4.6.0-preview6.19303.8\lib\netstandard2.0\System.Threading.Channels.dll” -a “C:\Users\DarrellTunnell.nuget\packages\system.threading.tasks.extensions\4.5.2\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll” -a “C:\Users\DarrellTunnell\source\repos\HubCore\src\Hub.Platform\Hub.Platform.Shared\bin\Debug\netstandard2.0\Hub.Platform.Shared.dll” -a “C:\Users\DarrellTunnell\source\repos\HubCore\src\Hub.Platform\Hub.Platform.Client\obj\Debug\netstandard2.0\Hub.Platform.Client.dll”” exited with code -532462766. [C:\Users\DarrellTunnell\source\repos\HubCore\src\Hub.Platform\Hub.Platform.Client\Hub.Platform.Client.csproj]
Build FAILED.
Notes:
- I am using the latest VS (2019 Preview, 16.3.0 Preview 1.0)
- dotnet sdk: 3.0.100-preview7-012821
- I uninstalled the VS extension “Blazor” as I saw notes to say that wasn’t required anymore.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
@dazinator yes it might because ILLinker will try to find what is useless in your project binaries so If it finds something referencing (in your project or in a dependency) “System.Text.Json.Serialization.JsonSerializerOptions” it’ll try to find it. In this case this class moved a namespace upper in “System.Text.Json”. It could also be because of an other dependency. If you still want to execute your project, you can disable the linker by following this doc https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/blazor/configure-linker?view=aspnetcore-3.0
But you might have this error at runtime anyway.
I think that also happened to me, because some references where preview-6. Try upgrading everything.