dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.09k stars 9.91k forks source link

Build Error when referencing a bunch of standard libraries #5492

Closed TFTomSun closed 5 years ago

TFTomSun commented 6 years ago

First of all: Thanks for the great work. I love that project and I want to support it as much as i can.

I started with a simple Blazor (not hosted) project and referenced some of my existing .net standard projects incl. some 3rd party packages like selenium (WebDriver and WebDriver.Support) and Docker.DotNet.

When I try to build the app I get the following build error:

Severity    Code    Description Project File    Line    Suppression State
Error   MSB3073 The command "dotnet "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\../tools/illink/illink.dll" -c link -u link -t --verbose  -d "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\../tools/mono/bcl/" -d "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\../tools/mono/bcl/Facades/" -o "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BlazorApp\obj\Debug\netstandard2.0\blazor/linker/" -x "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\BuiltInBclLinkerDescriptor.xml" -x "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BlazorApp\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Development\Git\Nuget\packages\docker.dotnet\3.125.1\lib\netstandard2.0\Docker.DotNet.dll" -a "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor\0.1.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.browser\0.1.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.csharp\4.3.0\lib\netstandard1.3\Microsoft.CSharp.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection.abstractions\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Development\Git\Nuget\packages\newtonsoft.json\10.0.3\lib\netstandard1.3\Newtonsoft.Json.dll" -a "C:\Development\Git\Nuget\packages\selenium.support\3.10.0\lib\netstandard2.0\WebDriver.Support.dll" -a "C:\Development\Git\Nuget\packages\selenium.webdriver\3.10.0\lib\netstandard2.0\WebDriver.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.buffers\4.4.0\lib\netstandard2.0\System.Buffers.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.collections.nongeneric\4.3.0\lib\netstandard1.3\System.Collections.NonGeneric.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.collections.specialized\4.3.0\lib\netstandard1.3\System.Collections.Specialized.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel\4.3.0\lib\netstandard1.3\System.ComponentModel.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.primitives\4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.typeconverter\4.3.0\lib\netstandard1.5\System.ComponentModel.TypeConverter.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.dynamic.runtime\4.3.0\lib\netstandard1.3\System.Dynamic.Runtime.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.io.filesystem.primitives\4.3.0\lib\netstandard1.3\System.IO.FileSystem.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.linq\4.3.0\lib\netstandard1.6\System.Linq.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.linq.expressions\4.3.0\lib\netstandard1.6\System.Linq.Expressions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.objectmodel\4.3.0\lib\netstandard1.3\System.ObjectModel.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit\4.3.0\lib\netstandard1.3\System.Reflection.Emit.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit.ilgeneration\4.3.0\lib\netstandard1.3\System.Reflection.Emit.ILGeneration.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit.lightweight\4.3.0\lib\netstandard1.3\System.Reflection.Emit.Lightweight.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.typeextensions\4.3.0\lib\netstandard1.5\System.Reflection.TypeExtensions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.serialization.formatters\4.3.0\lib\netstandard1.4\System.Runtime.Serialization.Formatters.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.serialization.primitives\4.3.0\lib\netstandard1.3\System.Runtime.Serialization.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.text.regularexpressions\4.3.0\lib\netstandard1.6\System.Text.RegularExpressions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.threading\4.3.0\lib\netstandard1.3\System.Threading.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.threading.tasks.extensions\4.3.0\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.xml.readerwriter\4.3.0\lib\netstandard1.3\System.Xml.ReaderWriter.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.xml.xmldocument\4.3.0\lib\netstandard1.3\System.Xml.XmlDocument.dll" -a "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BusinessLogic\bin\Debug\netstandard2.0\FFXIVCollector.BusinessLogic.dll" -a "C:\Development\Git\NetStandard.Extensions\TomSun.NetStandard.Extensions\bin\Debug\netstandard1.0\TomSun.NetStandard.Extensions.dll" -a "C:\Development\Git\NetStandard.Platform\TomSun.NetStandard.Platform\bin\Debug\netstandard1.0\TomSun.NetStandard.Platform.dll" -a "C:\Development\Git\Selenium.Extensions\TomSun.Selenium.Extensions\bin\Debug\netstandard2.0\TomSun.Selenium.Extensions.dll" -a "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BlazorApp\obj\Debug\netstandard2.0\FFXIVCollector.BlazorApp.dll"" exited with code 1. FFXIVCollector.BlazorApp    C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\Blazor.MonoRuntime.targets    429 

The build output is:

1>------ Build started: Project: FFXIVCollector.BlazorApp, Configuration: Debug Any CPU ------
1>----- Smart Resolve References -----
1>FFXIVCollector.BlazorApp -> C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BlazorApp\bin\Debug\netstandard2.0\FFXIVCollector.BlazorApp.dll
1>Cannot find declaration of exported type 'System.Threading.Semaphore' from the assembly 'System.Threading, Version=4.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>Cannot find declaration of exported type 'System.Reflection.Emit.DynamicMethod' from the assembly 'System.Reflection.Emit.Lightweight, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
1>Processing embedded resource linker descriptor: mscorlib.xml
1>Fatal error in IL Linker
1>Mono.Linker.MarkException: Error processing method: 'System.Boolean System.Linq.Expressions.Compiler.ILGen::ShouldLdtoken(System.Reflection.MethodBase)' in assembly: 'System.Linq.Expressions.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Reflection.Emit.DynamicMethod
1>   at Mono.Linker.Steps.MarkStep.HandleUnresolvedType(TypeReference reference)
1>   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
1>   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
1>   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
1>   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
1>   at Mono.Linker.Steps.MarkStep.ProcessQueue()
1>   --- End of inner exception stack trace ---
1>   at Mono.Linker.Steps.MarkStep.ProcessQueue()
1>   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
1>   at Mono.Linker.Steps.MarkStep.Process()
1>   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
1>   at Mono.Linker.Pipeline.Process(LinkContext context)
1>   at Mono.Linker.Driver.Run(ILogger customLogger)
1>   at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
1>C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\Blazor.MonoRuntime.targets(429,5): error MSB3073: The command "dotnet "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\../tools/illink/illink.dll" -c link -u link -t --verbose  -d "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\../tools/mono/bcl/" -d "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\../tools/mono/bcl/Facades/" -o "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BlazorApp\obj\Debug\netstandard2.0\blazor/linker/" -x "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\BuiltInBclLinkerDescriptor.xml" -x "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BlazorApp\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Development\Git\Nuget\packages\docker.dotnet\3.125.1\lib\netstandard2.0\Docker.DotNet.dll" -a "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor\0.1.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Development\Git\Nuget\packages\microsoft.aspnetcore.blazor.browser\0.1.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.csharp\4.3.0\lib\netstandard1.3\Microsoft.CSharp.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection.abstractions\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Development\Git\Nuget\packages\newtonsoft.json\10.0.3\lib\netstandard1.3\Newtonsoft.Json.dll" -a "C:\Development\Git\Nuget\packages\selenium.support\3.10.0\lib\netstandard2.0\WebDriver.Support.dll" -a "C:\Development\Git\Nuget\packages\selenium.webdriver\3.10.0\lib\netstandard2.0\WebDriver.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.buffers\4.4.0\lib\netstandard2.0\System.Buffers.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.collections.nongeneric\4.3.0\lib\netstandard1.3\System.Collections.NonGeneric.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.collections.specialized\4.3.0\lib\netstandard1.3\System.Collections.Specialized.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel\4.3.0\lib\netstandard1.3\System.ComponentModel.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.primitives\4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.typeconverter\4.3.0\lib\netstandard1.5\System.ComponentModel.TypeConverter.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.dynamic.runtime\4.3.0\lib\netstandard1.3\System.Dynamic.Runtime.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.io.filesystem.primitives\4.3.0\lib\netstandard1.3\System.IO.FileSystem.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.linq\4.3.0\lib\netstandard1.6\System.Linq.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.linq.expressions\4.3.0\lib\netstandard1.6\System.Linq.Expressions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.objectmodel\4.3.0\lib\netstandard1.3\System.ObjectModel.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit\4.3.0\lib\netstandard1.3\System.Reflection.Emit.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit.ilgeneration\4.3.0\lib\netstandard1.3\System.Reflection.Emit.ILGeneration.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit.lightweight\4.3.0\lib\netstandard1.3\System.Reflection.Emit.Lightweight.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.typeextensions\4.3.0\lib\netstandard1.5\System.Reflection.TypeExtensions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.serialization.formatters\4.3.0\lib\netstandard1.4\System.Runtime.Serialization.Formatters.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.serialization.primitives\4.3.0\lib\netstandard1.3\System.Runtime.Serialization.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.text.regularexpressions\4.3.0\lib\netstandard1.6\System.Text.RegularExpressions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.threading\4.3.0\lib\netstandard1.3\System.Threading.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.threading.tasks.extensions\4.3.0\lib\netstandard1.0\System.Threading.Tasks.Extensions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.xml.readerwriter\4.3.0\lib\netstandard1.3\System.Xml.ReaderWriter.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.xml.xmldocument\4.3.0\lib\netstandard1.3\System.Xml.XmlDocument.dll" -a "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BusinessLogic\bin\Debug\netstandard2.0\FFXIVCollector.BusinessLogic.dll" -a "C:\Development\Git\NetStandard.Extensions\TomSun.NetStandard.Extensions\bin\Debug\netstandard1.0\TomSun.NetStandard.Extensions.dll" -a "C:\Development\Git\NetStandard.Platform\TomSun.NetStandard.Platform\bin\Debug\netstandard1.0\TomSun.NetStandard.Platform.dll" -a "C:\Development\Git\Selenium.Extensions\TomSun.Selenium.Extensions\bin\Debug\netstandard2.0\TomSun.Selenium.Extensions.dll" -a "C:\Development\Git\FFXIVCollector.WebApi\FFXIVCollector.BlazorApp\obj\Debug\netstandard2.0\FFXIVCollector.BlazorApp.dll"" exited with code 1.
1>Done building project "FFXIVCollector.BlazorApp.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 4 up-to-date, 0 skipped ==========

Is there somewhere a "not yet supported" list?

conficient commented 6 years ago

Blazor is built using mono-wasm as the base .NET framework implementation, and in this case I believe it's a missing method in mono-wasm that's the issue.

Cannot find declaration of exported type 'System.Threading.Semaphore' from the assembly 'System.Threading ...
grahamehorner commented 6 years ago

@conficient @TFTomSun at present Mono WASM has no support for threading; check the repo https://github.com/lrz/mono-wasm-mono for more info

danroth27 commented 6 years ago

@kumpera

danroth27 commented 6 years ago

@javiercn Can you take a look at what's happening here? Is this an issue with the linker? With Mono's .NET Standard support? Something else?

TFTomSun commented 6 years ago

@javiercn Let me know tell me if you need a reproducible scenario.

If threading and the expression stuff is not supported by mono wasm i would at least prefer to get a error message, that points me to the exact method or code line that is not compilable. As it is at the moment, I don't know how to workaround that issue.

mserradotnet commented 6 years ago

Hi,

I ran into the same issue with the default Blazor template (not hosted).

It builds and runs fine, but then just adding Newtonsoft.Json as a dependency (dotnet add package Newtonsoft.Json) followed by a 'dotnet build' throws the mentioned error by @TFTomSun .

I'm on MacOS

kumpera commented 6 years ago

Mono has support for System.Linq.Expression without the SRE based compiler. I need to see why it's not enabled on our setup.

marek-safar commented 6 years ago

The problem is that WASM is not netstandard compliant right now and there is no TFM for WASM as of today for us to customize it.

As a hack you can use the assembly I attached which should unlock you on this matter if you use it as a replacement for the same one in bin folder (e.g. using post-build copy) System.Reflection.Emit.Lightweight.dll.zip

marinasundstrom commented 6 years ago

@marek-safar OK. How do I set this up?

I tried this in my project file:

 <Target Name="CopyFiles" BeforeTargets="GetCopyToOutputDirectoryItems">
     <Copy SourceFiles="System.Reflection.Emit.Lightweight.dll" DestinationFolder="$(OutputPath)" ContinueOnError="true" />
  </Target>

Can't make this work. I get the same error.

marinasundstrom commented 6 years ago

The workaround works by replacing the corresponding file System.Reflection.Emit.Lightweight.dll in ~/.nuget/packages/system.reflection.emit.lightweight/4.3.0/lib/netstandard1.3/

mserradotnet commented 6 years ago

@robertsundstrom Thank you, this builds fine with your method.

SteveSandersonMS commented 6 years ago

@TFTomSun, @robertsundstrom, @marek-safar: Can you supply a simple repro for this?

I tried referencing System.Threading.Semaphore and Newtonsoft.Json.JsonConvert from a Blazor app and it still compiled fine. I'm not saying they would necessarily work at runtime (didn't check), but the comments above say there's a compile-time error.

marinasundstrom commented 6 years ago

@SteveSandersonMS Sure. I got that error while compiling this without the workaround: https://github.com/robertsundstrom/ChatSample-WebAssembly-SignalR

SteveSandersonMS commented 6 years ago

Note to future bug-fixer: For an easily repro, see https://github.com/aspnet/Blazor/issues/436

TFTomSun commented 6 years ago

@robertsundstrom I tried your workaround and copied the dll into the folder: Nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\tools\mono\bcl\Facades Thats the only folder under my nuget package root that contains a dll with the same name. When I replace the dll I still get the same error. Any idea what i' doing wrong?

marinasundstrom commented 6 years ago

@TFTomSun The directory to place it in is ~/.nuget/packages/system.reflection.emit.lightweight/4.3.0/lib/netstandard1.3

~ in the path is your home-directory.

TFTomSun commented 6 years ago

Thanks. got it. I wasn't aware of all that nuget package folders. Actually i thought when i specify my own folder via nuget.config, all package will be downloaded into this folder. Seems that nuget is still looking in the users folder, even if a nuget.config is in place.

My approach is now to delete the packages folder under the users folder and all nugetfallback folders. I got the package downloaded into my "specified" folder. Unfortunately i still get the same build error. I'll tryout a bit more and add some feedback here later.

TFTomSun commented 6 years ago

@robertsundstrom

ah... actually i get only one of the two errors now. This one is leftover:

Cannot find declaration of exported type 'System.Threading.Semaphore' from the assembly 'System.Threading, Version=4.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

Any chance to workaround that too?

Edit: Got it buildable now. The build error was actually another one. I just saw the same message in the output and thought that the threading stuff still fails my build.

chassq commented 6 years ago

This may be the same issue for me when trying to add System.Linq.Dynamic.Core to the Blazor Client project. Adding the system.reflection.emit.lightweight.dll file mentioned above did not seem to help.

I get compile time errors as follows:

Severity Code Description Project File Line Suppression State Error MSB3073 The command "dotnet "C:\Users\sqadmin.nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets../tools/illink/illink.dll" -c link -u link -t --verbose -d "C:\Users\sqadmin.nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets../tools/mono/bcl/" -d "C:\Users\sqadmin.nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets../tools/mono/bcl/Facades/" -o "C:\Users\sqadmin\source\repos\TestBlazorProj\TestBlazorProj\TestBlazorProj.Client\obj\Debug\netstandard2.0\blazor/linker/" -x "C:\Users\sqadmin.nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\BuiltInBclLinkerDescriptor.xml" -x "C:\Users\sqadmin\source\repos\TestBlazorProj\TestBlazorProj\TestBlazorProj.Client\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Users\sqadmin.nuget\packages\microsoft.aspnetcore.blazor\0.1.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Users\sqadmin.nuget\packages\microsoft.aspnetcore.blazor.browser\0.1.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection.abstractions\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.collections.concurrent\4.3.0\lib\netstandard1.3\System.Collections.Concurrent.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.collections.nongeneric\4.3.0\lib\netstandard1.3\System.Collections.NonGeneric.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.collections.specialized\4.3.0\lib\netstandard1.3\System.Collections.Specialized.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel\4.3.0\lib\netstandard1.3\System.ComponentModel.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.primitives\4.3.0\lib\netstandard1.0\System.ComponentModel.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.componentmodel.typeconverter\4.3.0\lib\netstandard1.5\System.ComponentModel.TypeConverter.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.dynamic.runtime\4.3.0\lib\netstandard1.3\System.Dynamic.Runtime.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.linq\4.3.0\lib\netstandard1.6\System.Linq.dll" -a "C:\Users\sqadmin.nuget\packages\system.linq.dynamic.core\1.0.8.3\lib\netstandard2.0\System.Linq.Dynamic.Core.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.linq.expressions\4.3.0\lib\netstandard1.6\System.Linq.Expressions.dll" -a "C:\Users\sqadmin.nuget\packages\system.linq.queryable\4.3.0\lib\netstandard1.3\System.Linq.Queryable.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.objectmodel\4.3.0\lib\netstandard1.3\System.ObjectModel.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit\4.3.0\lib\netstandard1.3\System.Reflection.Emit.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit.ilgeneration\4.3.0\lib\netstandard1.3\System.Reflection.Emit.ILGeneration.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.emit.lightweight\4.3.0\lib\netstandard1.3\System.Reflection.Emit.Lightweight.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.typeextensions\4.3.0\lib\netstandard1.5\System.Reflection.TypeExtensions.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.threading\4.3.0\lib\netstandard1.3\System.Threading.dll" -a "C:\Users\sqadmin\source\repos\TestBlazorProj\TestBlazorProj\TestBlazorProj.Shared\bin\Debug\netstandard2.0\TestBlazorProj.Shared.dll" -a "C:\Users\sqadmin\source\repos\TestBlazorProj\TestBlazorProj\TestBlazorProj.Client\obj\Debug\netstandard2.0\TestBlazorProj.Client.dll"" exited with code 1. TestBlazorProj.Client C:\Users\sqadmin.nuget\packages\microsoft.aspnetcore.blazor.build\0.1.0\targets\Blazor.MonoRuntime.targets 429

SteveSandersonMS commented 6 years ago

OK. For now if you want to use those assemblies you'll need to disable linking via <BlazorLinkOnBuild>false</BlazorLinkOnBuild> in your csproj file.

Later on we'll:

Hopefully for a very large majority of commonly-used NuGet packages, we can provide a built-in config that makes it work out-of-the-box.

chassq commented 6 years ago

Not sure if this is related (or a blazor issue) but wanted to submit it. When trying to use System.Linq.Dynamic.Core NuGet pkg I get the following error when trying to use the Dynamic Linq OrderBy(string) overload. Error and sample code follow:

ERROR:

MonoPlatform.ts:85 Uncaught Error: System.TypeInitializationException: The type initializer for 'System.Linq.Dynamic.Core.DynamicQueryableExtensions' threw an exception. ---> System.InvalidOperationException: Sequence contains no matching element
  at System.Linq.Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) <0x1e2bfd8 + 0x000e0> in <d120aeb8020649c4beeadecdff0b90a6>:0 
  at System.Linq.Dynamic.Core.DynamicQueryableExtensions.GetMethod (System.String name, System.Int32 parameterCount, System.Func`2[T,TResult] predicate) <0x1e2bac8 + 0x00056> in <94a13b5566d042a5a17d981cb7d5870e>:0 
  at System.Linq.Dynamic.Core.DynamicQueryableExtensions..cctor () <0x1e20120 + 0x0015a> in <94a13b5566d042a5a17d981cb7d5870e>:0 
   --- End of inner exception stack trace ---
  at TestBlazorProj.Client.Pages.PeopleData.SortClientSide () <0x1e1f8a0 + 0x00036> in <cff7510823de412ea0de57c1b5639e03>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void()
  at Microsoft.AspNetCore.Blazor.Components.BlazorComponent+<>c__DisplayClass22_0.<onclick>b__0 (Microsoft.AspNetCore.Blazor.UIEventArgs _) <0x1e1f660 + 0x00014> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_UIEventArgs(Microsoft.AspNetCore.Blazor.UIEventArgs)
  at Microsoft.AspNetCore.Blazor.Components.BlazorComponent.Microsoft.AspNetCore.Blazor.Components.IHandleEvent.HandleEvent (Microsoft.AspNetCore.Blazor.UIEventHandler handler, Microsoft.AspNetCore.Blazor.UIEventArgs args) <0x1e1f4f0 + 0x00018> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at Microsoft.AspNetCore.Blazor.Rendering.ComponentState.DispatchEvent (Microsoft.AspNetCore.Blazor.UIEventHandler handler, Microsoft.AspNetCore.Blazor.UIEventArgs eventArgs) <0x1e1cef0 + 0x00034> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at Microsoft.AspNetCore.Blazor.Rendering.Renderer.DispatchEvent (System.Int32 componentId, System.Int32 eventHandlerId, Microsoft.AspNetCore.Blazor.UIEventArgs eventArgs) <0x1e1cb58 + 0x00050> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at Microsoft.AspNetCore.Blazor.Browser.Rendering.BrowserRenderer.DispatchBrowserEvent (System.Int32 componentId, System.Int32 eventHandlerId, Microsoft.AspNetCore.Blazor.UIEventArgs eventArgs) <0x1e1c9f0 + 0x00020> in <aa678c00565443a1a03daf9fa7da0de1>:0 
  at Microsoft.AspNetCore.Blazor.Browser.Rendering.BrowserRendererEventDispatcher.DispatchEvent (System.String eventDescriptorJson, System.String eventArgsJson) <0x1db8c28 + 0x0005a> in <aa678c00565443a1a03daf9fa7da0de1>:0 
  at System.Linq.Enumerable.Single[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) <0x1e2bfd8 + 0x000e0> in <d120aeb8020649c4beeadecdff0b90a6>:0 
  at System.Linq.Dynamic.Core.DynamicQueryableExtensions.GetMethod (System.String name, System.Int32 parameterCount, System.Func`2[T,TResult] predicate) <0x1e2bac8 + 0x00056> in <94a13b5566d042a5a17d981cb7d5870e>:0 
  at System.Linq.Dynamic.Core.DynamicQueryableExtensions..cctor () <0x1e20120 + 0x0015a> in <94a13b5566d042a5a17d981cb7d5870e>:0 
   --- End of inner exception stack trace ---
  at TestBlazorProj.Client.Pages.PeopleData.SortClientSide () <0x1e1f8a0 + 0x00036> in <cff7510823de412ea0de57c1b5639e03>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void()
  at Microsoft.AspNetCore.Blazor.Components.BlazorComponent+<>c__DisplayClass22_0.<onclick>b__0 (Microsoft.AspNetCore.Blazor.UIEventArgs _) <0x1e1f660 + 0x00014> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_UIEventArgs(Microsoft.AspNetCore.Blazor.UIEventArgs)
  at Microsoft.AspNetCore.Blazor.Components.BlazorComponent.Microsoft.AspNetCore.Blazor.Components.IHandleEvent.HandleEvent (Microsoft.AspNetCore.Blazor.UIEventHandler handler, Microsoft.AspNetCore.Blazor.UIEventArgs args) <0x1e1f4f0 + 0x00018> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at Microsoft.AspNetCore.Blazor.Rendering.ComponentState.DispatchEvent (Microsoft.AspNetCore.Blazor.UIEventHandler handler, Microsoft.AspNetCore.Blazor.UIEventArgs eventArgs) <0x1e1cef0 + 0x00034> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at Microsoft.AspNetCore.Blazor.Rendering.Renderer.DispatchEvent (System.Int32 componentId, System.Int32 eventHandlerId, Microsoft.AspNetCore.Blazor.UIEventArgs eventArgs) <0x1e1cb58 + 0x00050> in <6f55c2fa30114054ab77a67cb3b359ec>:0 
  at Microsoft.AspNetCore.Blazor.Browser.Rendering.BrowserRenderer.DispatchBrowserEvent (System.Int32 componentId, System.Int32 eventHandlerId, Microsoft.AspNetCore.Blazor.UIEventArgs eventArgs) <0x1e1c9f0 + 0x00020> in <aa678c00565443a1a03daf9fa7da0de1>:0 
  at Microsoft.AspNetCore.Blazor.Browser.Rendering.BrowserRendererEventDispatcher.DispatchEvent (System.String eventDescriptorJson, System.String eventArgsJson) <0x1db8c28 + 0x0005a> in <aa678c00565443a1a03daf9fa7da0de1>:0 
    at Object.callMethod (http://localhost:50296/_framework/blazor.js:439:23)
    at raiseEvent (http://localhost:50296/_framework/blazor.js:927:28)
    at HTMLButtonElement.listener [as _blazorClickListener] (http://localhost:50296/_framework/blazor.js:814:56)
callMethod @ MonoPlatform.ts:85
raiseEvent @ BrowserRenderer.ts:310
listener @ BrowserRenderer.ts:183

CODE:

@using TestBlazorProj.Shared.people
@using System.Linq
@using System.Linq.Dynamic.Core

@page "/people/list"
@inject HttpClient Http

<h1>People Data</h1>
<p>List people data.</p>

@if (people == null)
{
    <p><em>Loading...</em></p>
}
else
{
    <button @onclick(SortClientSide)> Sort Table </button>

    <table class='table'>
        <thead>
            <tr>
                <th>Prefix</th>
                <th>First Name</th>
                <th>Middle Name</th>
                <th>Last Name</th>
                <th>Suffix</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var p in people)
            {
                <tr>
                    <td>@p.Prefix</td>
                    <td>@p.FirstName</td>
                    <td>@p.MiddleName</td>
                    <td>@p.LastName</td>
                    <td>@p.Suffix</td>
                </tr>
            }
        </tbody>
    </table>
}

@functions {
    IEnumerable<PeopleVm> people;

    protected override async Task OnInitAsync()
    {
        //people = await Http.GetJsonAsync<IEnumerable<PeopleVm>>("/people/list");
        people = new List<PeopleVm>
                        {
                            new PeopleVm {Prefix = "Mr.", FirstName = "Person1FName", LastName = "Person1LName", MiddleName="Person1MName", Suffix = "" },
                            new PeopleVm {Prefix = "Mr.", FirstName = "Person2FName", LastName = "Person2LName", MiddleName="Person2MName", Suffix = "Sr." },
                            new PeopleVm {Prefix = "Mr.", FirstName = "Person3FName", LastName = "Person3LName", MiddleName="Person3MName", Suffix = "Jr." },
                            new PeopleVm {Prefix = "Ms.", FirstName = "Person4FName", LastName = "Person4LName", MiddleName="Person4MName", Suffix = "" },
                        };
    }

    private void SortClientSide()
    {
        //dynamic linq
        if(people != null)
        {
            var q = people.AsQueryable<PeopleVm>();
            var pq = q.OrderBy("MiddleName");
            //var pq = q.OrderBy(p => p.MiddleName); //This works!
            people = pq.ToList();
        }

        //standard linq
        //people = people.OrderByDescending(p => p.MiddleName).ToList();
    }
}
kumpera commented 6 years ago

CC @marek-safar @mhutch

DNF-SaS commented 6 years ago

+1 for random (at least they look random to me) build errors when using a lot of nuget-packages.

SteveSandersonMS commented 6 years ago

@DNF-SaS If you have information about which specific packages make the linker throw that would be helpful.

DNF-SaS commented 6 years ago

@SteveSandersonMS Sure, use the following lines as .csproj in a default blazor project.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <RunCommand>dotnet</RunCommand>
    <RunArguments>blazor serve</RunArguments>
    <RestoreSources>
      $(RestoreSources);
      https://api.nuget.org/v3/index.json;
      https://dotnet.myget.org/f/blazor-dev/api/v3/index.json;
    </RestoreSources>
    <LangVersion>7.3</LangVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Flurl.Http" Version="2.3.1" />
    <PackageReference Include="Humanizer.Core.de" Version="2.2.0" />
    <PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="1.0.0-preview2-final" />
    <PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.1.0-preview2-final" />
    <PackageReference Include="MimeKit" Version="2.0.3" />
    <PackageReference Include="Newtonsoft.Json" Version="11.0.2" />

    <PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.3.0-preview1-10252" />
    <PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.3.0-preview1-10252" />
    <DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.3.0-preview1-10252" />
  </ItemGroup>

</Project>

Error is

1>Target _LinkBlazorApplication:
1>  Fatal error in IL Linker
1>  Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'c:\temp\WebApplication11\WebApplication11\obj\Debug\netstandard20\WebApplication11.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'c:\temp\WebApplication11\WebApplication11\obj\Debug\netstandard20\WebApplication11.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
1>     at Mono.Linker.DirectoryAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
1>     at Mono.Linker.AssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)
1>     at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
1>     at Mono.Linker.LinkContext.Resolve(IMetadataScope scope)
1>     at Mono.Linker.LinkContext.Resolve(String name)
1>     at Mono.Linker.Steps.ResolveFromAssemblyStep.Process()
1>     at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
1>     at Mono.Linker.Pipeline.Process(LinkContext context)
1>     at Mono.Linker.Driver.Run(ILogger customLogger)
1>     at Mono.Linker.Driver.Execute(String[] args, ILogger customLogger)
1>  C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.blazor.build\0.3.0-preview1-10252\targets\Blazor.MonoRuntime.targets(435,5): error MSB3073: The command "dotnet "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.blazor.build\0.3.0-preview1-10252\targets\../tools/illink/illink.dll" -c link -u link -t --verbose  -d "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.blazor.build\0.3.0-preview1-10252\targets\../tools/mono/bcl/" -d "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.blazor.build\0.3.0-preview1-10252\targets\../tools/mono/bcl/Facades/" -o "c:\temp\WebApplication11\WebApplication11\obj\Debug\netstandard2.0\blazor/linker/" -x "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.blazor.build\0.3.0-preview1-10252\targets\BuiltInBclLinkerDescriptor.xml" -x "c:\temp\WebApplication11\WebApplication11\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Users\SaS\.nuget\packages\flurl\2.7.1\lib\netstandard2.0\Flurl.dll" -a "C:\Users\SaS\.nuget\packages\flurl.http\2.3.1\lib\netstandard2.0\Flurl.Http.dll" -a "C:\Users\SaS\.nuget\packages\humanizer.core\2.2.0\lib\netstandard1.0\Humanizer.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.blazor\0.3.0-preview1-10252\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.blazor.browser\0.3.0-preview1-10252\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.connections.abstractions\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.Connections.Abstractions.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.http.connections.client\1.0.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.Http.Connections.Client.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.http.connections.common\1.0.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.Http.Connections.Common.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.http.features\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.Http.Features.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.signalr.client\1.0.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Client.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.signalr.client.core\1.0.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Client.Core.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.signalr.common\1.0.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.SignalR.Common.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.aspnetcore.webutilities\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.configuration\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Configuration.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.configuration.abstractions\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Configuration.Abstractions.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.configuration.binder\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Configuration.Binder.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.dependencyinjection\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.logging\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Logging.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.logging.abstractions\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Logging.Abstractions.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.logging.configuration\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Logging.Configuration.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.logging.console\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Logging.Console.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.options\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Options.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.options.configurationextensions\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.extensions.primitives\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Extensions.Primitives.dll" -a "C:\Users\SaS\.nuget\packages\microsoft.net.http.headers\2.1.0-preview2-final\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll" -a "C:\Users\SaS\.nuget\packages\mimekit\2.0.3\lib\netstandard2.0\MimeKit.dll" -a "C:\Users\SaS\.nuget\packages\newtonsoft.json\11.0.2\lib\netstandard2.0\Newtonsoft.Json.dll" -a "C:\Users\SaS\.nuget\packages\portable.bouncycastle\1.8.1.3\lib\netstandard2.0\BouncyCastle.Crypto.dll" -a "C:\Users\SaS\.nuget\packages\system.buffers\4.5.0-preview2-26406-04\lib\netstandard2.0\System.Buffers.dll" -a "C:\Users\SaS\.nuget\packages\system.collections.concurrent\4.3.0\lib\netstandard1.3\System.Collections.Concurrent.dll" -a "C:\Users\SaS\.nuget\packages\system.data.common\4.3.0\lib\netstandard1.2\System.Data.Common.dll" -a "C:\Users\SaS\.nuget\packages\system.diagnostics.diagnosticsource\4.3.0\lib\netstandard1.3\System.Diagnostics.DiagnosticSource.dll" -a "C:\Users\SaS\.nuget\packages\system.io.filesystem.primitives\4.3.0\lib\netstandard1.3\System.IO.FileSystem.Primitives.dll" -a "C:\Users\SaS\.nuget\packages\system.io.pipelines\4.5.0-preview2-26406-04\lib\netstandard2.0\System.IO.Pipelines.dll" -a "C:\Users\SaS\.nuget\packages\system.linq\4.3.0\lib\netstandard1.6\System.Linq.dll" -a "C:\Users\SaS\.nuget\packages\system.memory\4.5.0-preview2-26406-04\lib\netstandard2.0\System.Memory.dll" -a "C:\Users\SaS\.nuget\packages\system.numerics.vectors\4.5.0-preview2-26406-04\lib\netstandard2.0\System.Numerics.Vectors.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.reflection.typeextensions\4.3.0\lib\netstandard1.5\System.Reflection.TypeExtensions.dll" -a "C:\Users\SaS\.nuget\packages\system.runtime.compilerservices.unsafe\4.5.0-preview2-26406-04\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll" -a "C:\Users\SaS\.nuget\packages\system.runtime.numerics\4.3.0\lib\netstandard1.3\System.Runtime.Numerics.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.runtime.serialization.primitives\4.3.0\lib\netstandard1.3\System.Runtime.Serialization.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.security.claims\4.3.0\lib\netstandard1.3\System.Security.Claims.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.security.cryptography.openssl\4.3.0\lib\netstandard1.6\System.Security.Cryptography.OpenSsl.dll" -a "C:\Users\SaS\.nuget\packages\system.security.cryptography.primitives\4.3.0\lib\netstandard1.3\System.Security.Cryptography.Primitives.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.security.principal\4.3.0\lib\netstandard1.0\System.Security.Principal.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.text.encoding.codepages\4.4.0\lib\netstandard2.0\System.Text.Encoding.CodePages.dll" -a "C:\Users\SaS\.nuget\packages\system.text.encodings.web\4.5.0-preview2-26406-04\lib\netstandard2.0\System.Text.Encodings.Web.dll" -a "C:\Users\SaS\.nuget\packages\system.text.regularexpressions\4.3.0\lib\netstandard1.6\System.Text.RegularExpressions.dll" -a "C:\Users\SaS\.nuget\packages\system.threading\4.3.0\lib\netstandard1.3\System.Threading.dll" -a "C:\Users\SaS\.nuget\packages\system.threading.channels\4.5.0-preview2-26406-04\lib\netstandard2.0\System.Threading.Channels.dll" -a "C:\Users\SaS\.nuget\packages\system.threading.tasks.extensions\4.5.0-preview2-26406-04\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll" -a "C:\Users\SaS\.nuget\packages\system.threading.thread\4.3.0\lib\netstandard1.3\System.Threading.Thread.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\system.threading.threadpool\4.3.0\lib\netstandard1.3\System.Threading.ThreadPool.dll" -a "C:\Users\SaS\.nuget\packages\humanizer.core.de\2.2.0\lib\netstandard1.0\de\Humanizer.resources.dll" -a "c:\temp\WebApplication11\WebApplication11\obj\Debug\netstandard2.0\WebApplication11.dll"" exited with code 1.
jskeet commented 6 years ago

FWIW, I get a similar error installing Noda Time into the project.

Adding the <BlazorLinkOnBuild>false</BlazorLinkOnBuild> build property gets me past it temporarily, at which point I'm getting a TypeInitializationException deep inside Noda Time when it's building a time zone for some reason. I'll need to dig deeper into that...

alastairtree commented 6 years ago

Another very similar error in the linker when you install RestEase into a blazor client side package. The BlazorLinkOnBuild property then allows the build to complete and the underlying issue to surface as a runtime exception:

MonoPlatform.ts:70 Uncaught (in promise) Error: System.TypeInitializationException: The type initializer for 'RestEase.Implementation.ImplementationBuilder' threw an exception. ---> System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Reflection.Emit.AssemblyBuilder.DefineDynamicAssembly (System.Reflection.AssemblyName name, System.Reflection.Emit.AssemblyBuilderAccess access) <0x204cb50 + 0x0000c> in :0

So no RestEase in blazor for a while.

chassq commented 6 years ago

Related to my comments above about System.Linq.Dynamic.Core. It now seems to work with the latest 0.3.0 release and latest VS Preview.

MisinformedDNA commented 6 years ago

I found that if I have this package:

<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.3" />

the build will fail in VSTS. If I remove the package, it builds fine.

fileman commented 6 years ago

EF sql server pkg is for server side projects

MisinformedDNA commented 6 years ago

Yea, I realized that after I installed it. Locally, the app built fine, with it referenced, but failed once I tried to build in VSTS even though I never used the package. The point is that people need a way to know what is not supported without getting a vague error and banging their head on the door.

mkArtakMSFT commented 5 years ago

@SteveSandersonMS, is there any action from our side here or should this go to the Mono repo?

SteveSandersonMS commented 5 years ago

For anything that fails specifically due to the linker (i.e., works OK if you use <BlazorLinkOnBuild>false</BlazorLinkOnBuild>), then it should be reported to Mono and isn't something we can address in this repo.

mkArtakMSFT commented 5 years ago

This issue was moved to mono/mono#12604