Electron.WindowManager.CreateWindowAsync -> NullRef when debugging the ASP.NET core app #12

Closed
opened 2026-01-29 16:27:28 +00:00 by claunia · 1 comment
Owner

Originally created by @robertmuehsig on GitHub (Oct 19, 2017).

Originally assigned to: @GregorBiswanger on GitHub.

  public async void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Error");
            }

            app.UseStaticFiles();

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

            // Open the Electron-Window here
            await Electron.WindowManager.CreateWindowAsync();
        }
WebApplication6> Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
WebApplication6>    at ElectronNET.API.WindowManager.CreateWindowAsync(BrowserWindowOptions options, String loadUrl)
WebApplication6>    at ElectronNET.API.WindowManager.<CreateWindowAsync>d__7.MoveNext()
WebApplication6> --- End of stack trace from previous location where exception was thrown ---
WebApplication6>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
WebApplication6>    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
WebApplication6>    at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
WebApplication6>    at WebApplication6.Startup.<Configure>d__5.MoveNext() in D:\Users\muehsig\Documents\Visual Studio 2017\Projects\WebApplication6\WebApplication6\Startup.cs:line 51
WebApplication6> --- End of stack trace from previous location where exception was thrown ---
WebApplication6>    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
WebApplication6>    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
WebApplication6>    at System.Threading.ThreadPoolWorkQueue.Dispatch()
Originally created by @robertmuehsig on GitHub (Oct 19, 2017). Originally assigned to: @GregorBiswanger on GitHub. ``` public async void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); // Open the Electron-Window here await Electron.WindowManager.CreateWindowAsync(); } ``` ``` WebApplication6> Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object. WebApplication6> at ElectronNET.API.WindowManager.CreateWindowAsync(BrowserWindowOptions options, String loadUrl) WebApplication6> at ElectronNET.API.WindowManager.<CreateWindowAsync>d__7.MoveNext() WebApplication6> --- End of stack trace from previous location where exception was thrown --- WebApplication6> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() WebApplication6> at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) WebApplication6> at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() WebApplication6> at WebApplication6.Startup.<Configure>d__5.MoveNext() in D:\Users\muehsig\Documents\Visual Studio 2017\Projects\WebApplication6\WebApplication6\Startup.cs:line 51 WebApplication6> --- End of stack trace from previous location where exception was thrown --- WebApplication6> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() WebApplication6> at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) WebApplication6> at System.Threading.ThreadPoolWorkQueue.Dispatch() ```
claunia added the bugIn progress labels 2026-01-29 16:27:28 +00:00
Author
Owner

@GregorBiswanger commented on GitHub (Oct 23, 2017):

Problem was no hybrid support for classic asp.net web apps.
I implement a HybridSupport.IsElectronActive-Proptery. See in our sample app in the startup.cs and controllers code, how to use it.

@GregorBiswanger commented on GitHub (Oct 23, 2017): Problem was no hybrid support for classic asp.net web apps. I implement a `HybridSupport.IsElectronActive`-Proptery. See in our sample app in the startup.cs and controllers code, how to use it.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#12