question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor Preview 7 Linker error

See original GitHub issue

Having 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:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
RemiBoucommented, Jul 30, 2019

@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.

1reaction
stavroskasidiscommented, Jul 30, 2019

I think that also happened to me, because some references where preview-6. Try upgrading everything.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Blazor Preview 7 Linker error #12728 - dotnet/aspnetcore
Having updated my Blazor client solution from preview 6 to preview 7 followed this guidance doing a dotnet build results in the following ......
Read more >
Build fail for Asp.Net Core 3 (Blazor client side)
Basically, as far as I understand it, somewhere in Mono the IL Linker fails and throws this cryptic error message. We can see...
Read more >
Announcing .NET 8 Preview 7
ASP.NET Core describes new token antiforgery middleware with API and Blazor support, identity API updates, native AOT improvements, and more. .
Read more >
New Visual Studio Preview version makes my Blazor ...
I just get a 404 error on the blazor.webassembly.js, even though the file is in the bin/Debug wwwroot. This project runs fine and...
Read more >
ASP.NET Core in .NET 8 Preview 6: Blazor Updates and More
The latest release of .NET 8 Preview 6 brings significant additions and changes to ASP.NET Core. The most notable enhancements for this ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found