React.NET: React.AspNet(3.0.0) + React.Core(3.0.0) JSX build fail.

With React.AspNet 3.0.0, React.Core 3.0.0 running .NET Core, fetching JSX-files results in server error.

Startup.cs: ` using Microsoft.AspNetCore.Http; using React.AspNet; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging;

namespace DQSpider { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile(“appsettings.json”, optional: true, reloadOnChange: true) .AddJsonFile($“appsettings.{env.EnvironmentName}.json”, optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); }

    public IConfigurationRoot Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        // Add framework services.
        services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
        services.AddReact();
        services.AddMvc();
    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
    {
        loggerFactory.AddConsole(Configuration.GetSection("Logging"));
        loggerFactory.AddDebug();

        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
            app.UseBrowserLink();
        }
        else
        {
            app.UseExceptionHandler("/Home/Error");
        }




        app.UseReact(config =>
        {

            config.AddScript("~/js/tutorial.jsx");


        });
        app.UseStaticFiles();

        app.UseMvc(routes =>
        {
            routes.MapRoute(
                name: "default",
                template: "{controller=Home}/{action=Index}/{id?}");
        });
    }
}

} ` Navigating to the tutorial.jsx file in browser shows:

React.TinyIoC.TinyIoCResolutionException: Unable to resolve type: React.IReactEnvironment at React.TinyIoC.TinyIoCContainer.ResolveInternal(TypeRegistration registration, NamedParameterOverloads parameters, ResolveOptions options) at React.TinyIoC.TinyIoCContainer.ResolveResolveType at React.AspNet.BabelFileMiddleware.<Invoke>d__5.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.<Invoke>d__7.MoveNext()

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

@khawajaumarfarooq Thanks for sharing your ideas.