-
Notifications
You must be signed in to change notification settings - Fork 10.3k
FileLoadException on IServiceCollection.AddReact() #800
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
Comments
That's a good question. Do you have repro steps? |
Just create an empty application with ASP.NET 5, add React following these steps. If you try to run the application it comes up with the error :( |
Those instructions are based on very old versions of ASP.NET 5. Have you contacted them to ask if they have newer versions that are compatible with newer betas of ASP.NET 5. |
There seems to be an update on NuGet but I can't download it in VS, it only states that version 1.5.3 (and lower) is available... //// update: |
Bumping this because I just got another report of it (also see reactjs/React.NET#153). The exception looks like the following: System.IO.FileLoadException was unhandled by user code The strange thing is that the "React" assembly is strong-named. React.AspNet has a dependency on React.Core which contains React.dll, and I've verified that the latest version does indeed have the correct strong name. Note that ReactJS.NET does not support .NET Core at the moment, so this is only using dnx451. I haven't been able to replicate the issue myself, everything works as expected for me 😟 Any ideas what's going on here?
The latest version of ReactJS.NET was built against beta6, I'll release an update for beta7 soon. The instructions were outdated but I updated them a while ago. |
If you could provide a sample application that has the error that would be great. Can one of your users provide that info? |
The two people that have reported it so far are @TomGroeneboer (who originally reported this issue) and @jongalloway (who reported it earlier today). @jongalloway are you able to provide a sample app that exhibits the issue? |
Repro is here: https://github.com/jongalloway/react-js-net-repro All I did was:
|
Ahh, I see. The issue is that your web project is called "React", but the core ReactJS.NET assembly is also called "React" 😆 I think the assembly loader gets confused and tries to load your site's assembly rather than the ReactJS.NET assembly. This fails because the assembly React.AspNet referenced at build time was strongly-named, and the strong name doesn't match. If I rename your project from "React" to "Reactizzle", I don't get the strong typing error any more (I do get a different unrelated error, which is because the latest release of ReactJS.NET was build against beta6 rather than beta7. The latest master version does support beta 7). I tried the same thing with ASP.NET 4.5 + MVC 5, and the error is the one I would have expected: "Could not load file or assembly 'React, Version=1.5.0.0, Culture=neutral, PublicKeyToken=9aed67b161f7db78' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. " In this case the assembly bind log shows more details that help to debug the issue: LOG: Attempting download of new URL file:///c:/users/danlo/documents/visual studio 2015/Projects/ReactBug/React/bin/React.DLL. It seems like ASP.NET 5 still tries to load the assembly even though the version number doesn't match, resulting in a more confusing error message. |
We had the same problems a long time ago in signalr, then we called it Microsoft.AspNet.SignalR |
@davidfowl - It may be an edge case, but can the loader guard against this somehow (a referenced assembly having the same name as the site itself)? |
We don't look at strong names when loading assemblies. We could probably fail if 2 things have the same name in the graph but it's not something we're going to do in the short term. |
Hi Guys, this is still not working on my end, freshly installed vs2015, running beta7, empty new solution, mvc6 project, followed the instructions here http://reactjs.net/getting-started/aspnet5.html, run the project and getting the same error.... the error does not occur when cloning the git repo to my local disk, building it and then opening and running the mvc6 demo inside vs2015.... what config thingy am i missing here? BTW: none of the items, solution or project are called anything like react.... |
@jjkopmels Can you please provide a full stack trace of the exception? |
@Daniel15 sure: System.IO.FileNotFoundException was unhandled by user code Calling assembly : (Unknown).LOG: This bind starts in default load context. HResult=-2147024894 |
@jjkopmels That's a different error, it's because the current release version of ReactJS.NET only supports beta 6. The version in the repo supports beta 7 but you need to build it yourself at the moment. I'll post a beta 7 update soon. |
I just uploaded ReactJS.NET 1.5.5 which supports beta 7 :) |
Turned out I added reference (normal) while should be COMReference instead in project file. Very strange problem. Find out the latest word revealed by God for humankind guidance ! Read Quran now http://quran.com/25 |
…master [automated] Merge branch 'release/2.2' => 'master'
Hi guys,
I've encountered an issue when adding React to a project. If I try to do
services.AddReact()
in theConfigureServices
method in theStartup
class it throws aFileLoadExeption
with the following details:Could not load file or assembly 'React, Version=1.5.0.0, Culture=neutral, PublicKeyToken=9aed67b161f7db78' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
Does someone know why this happens and how I can resolve it?
I'm running CLR-x86-beta6 in Visual Studio 2015.
Thanks!
The text was updated successfully, but these errors were encountered: