Skip to content

React.NET Breaks on NET Core 3.0 Preview 4 #787

Description

@mbaumanndev

Please verify these steps before filing an issue, and check them off as you go

  • The relevant native JavascriptEngineSwitcher library packages are installed (such as JavaScriptEngineSwitcher.V8.Native.win-x64)
  • The VC++ 2017 runtime is installed
  • The value of SetUseReact and SetUseBabel is correct in ReactConfig.cs or Startup.cs
  • I've looked at the sample projects in this repo to verify that my app is configured correctly

I'm using these library versions:

  • ReactJS.NET: React.AspNet versions 4.1.1 - 4.2.0-beta1 - 5.0.0-alpha1
  • JavaScriptEngineSwitcher: ChakraCore v3.0.9 + win32, win64
  • react and react-dom: react 16.8.4 - react-dom 16.8.4
  • webpack: N/A
  • node: v10.14.1

Runtime environment:

  • OS: Windows 10 Eterprise 1803 x64
  • .NET Framework or .NET Core Version: .NET Core 3.0 Preview 4

Steps to reproduce

  • Start a blank ASP.NET Core 3.0 Preview 4 project
  • Follow the getting started guide for aspnet core : https://reactjs.net/getting-started/aspnetcore.html
  • When starting the app and loading a script handled by React.NET, loading the script (js/jsx/ts/tsx) end in an unhandled exception.

When loading JSX/TSX using React.NET with ASP.NET Core 3 Preview 4, there's an issue with the BabelFileMiddleware instanciation, since the constructor of the StaticFileMiddleware changed between netcore 2 and netcore 3.

Here's a stack trace :

System.MissingMethodException: Method not found: 'Void Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware..ctor(Microsoft.AspNetCore.Http.RequestDelegate, Microsoft.AspNetCore.Hosting.IHostingEnvironment, Microsoft.Extensions.Options.IOptions`1<Microsoft.AspNetCore.Builder.StaticFileOptions>, Microsoft.Extensions.Logging.ILoggerFactory)'.
at React.AspNet.BabelFileMiddleware.CreateFileMiddleware(IBabel babel)
at React.AspNet.BabelFileMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Since I need this for validating my computer science degree, I'm interested on contributing on this issue, and help to prepare a release wich is compatible with ASP.NET Core 3. Is there any work in progress for netcore 3 ? And, where can I find the sources for ReactJS.NET 5.0.0-alpha1 ? It seems that master only contains sources for 4.2.0-beta1 (and what's the differences between those two versions ?).

Activity

  1. dustinsoftware commented on Apr 29, 2019

    @dustinsoftware
    Contributor

    What's on the master branch is the alpha build, I forgot to push the bump to build.proj :) if you try and build this project against the ASP.NET Core 3 preview SDK you should see a build error for React.AspNet.

    I suspect the ctor breaking change is caused by dotnet/aspnetcore#7725

    If that is indeed the case, we'll need to ship compile different DLLs for .NET Core 2.x and 3.x.

    Feel free to send a PR but it will probably also need some changes to the build pipeline :) I have a little time to kill right now so I'll take a look.

  2. added this to the 5.0 milestone on Apr 29, 2019
  3. mbaumanndev commented on Apr 29, 2019

    @mbaumanndev
    Author

    I'll try to send a PR in the next few weeks :)

    Do you have a Slack or anything like this if I have any questions when I work on this, or should I ask my questions here in the comments ?

    For the different DLLs to ship, my first thoughts are that we may need to target netstandard2.1 (with compiler directives) especially for ASP.NET Core 3, since it will run on that platform if I did get all the annoucements, I'll take a closer look on that in the next few days.

  4. dustinsoftware commented on Apr 29, 2019

    @dustinsoftware
    Contributor
  5. dustinsoftware commented on May 2, 2019

    @dustinsoftware
    Contributor

    A WIP branch is available in #791. CI won’t pass until appveyor supports the 3.0 sdk which is in preview right now.

  6. Daniel15 commented on Jun 15, 2019

    @Daniel15
    Contributor

    I think we can close this now that #791 is done?

  7. dustinsoftware commented on Jun 16, 2019

    @dustinsoftware
    Contributor

    Yep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions