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
Build Error when referencing a bunch of standard libraries #5492
Comments
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.
|
@conficient @TFTomSun at present Mono WASM has no support for threading; check the repo https://github.com/lrz/mono-wasm-mono for more info |
@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? |
@javiercn 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. |
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 |
Mono has support for System.Linq.Expression without the SRE based compiler. I need to see why it's not enabled on our setup. |
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) |
@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. |
The workaround works by replacing the corresponding file |
@RobertSundstrom Thank you, this builds fine with your method. |
@TFTomSun, @RobertSundstrom, @marek-safar: Can you supply a simple repro for this? I tried referencing |
@SteveSandersonMS Sure. I got that error while compiling this without the workaround: https://github.com/robertsundstrom/ChatSample-WebAssembly-SignalR |
Note to future bug-fixer: For an easily repro, see https://github.com/aspnet/Blazor/issues/436 |
@RobertSundstrom I tried your workaround and copied the dll into the folder: |
@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. |
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. |
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: |
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 |
OK. For now if you want to use those assemblies you'll need to disable linking via 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. |
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:
CODE:
|
+1 for random (at least they look random to me) build errors when using a lot of nuget-packages. |
@DNF-SaS If you have information about which specific packages make the linker throw that would be helpful. |
@SteveSandersonMS Sure, use the following lines as .csproj in a default blazor project.
Error is
|
FWIW, I get a similar error installing Noda Time into the project. Adding the |
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. So no RestEase in blazor for a while. |
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. |
I found that if I have this package:
the build will fail in VSTS. If I remove the package, it builds fine. |
EF sql server pkg is for server side projects |
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. |
@SteveSandersonMS, is there any action from our side here or should this go to the Mono repo? |
For anything that fails specifically due to the linker (i.e., works OK if you use |
This issue was moved to mono/mono#12604 |
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:
The build output is:
Is there somewhere a "not yet supported" list?
The text was updated successfully, but these errors were encountered: