Application UI does not start on some laptops. No log or error
See original GitHub issueWe have built an app using Electron.NET and ASP.NET on .Net 5. This app does not run on our client’s laptop and on one more laptop but otherwise runs on developer/ non-developer machines and VMs otherwise.
We have found that the async call to CreateBrowserWindowAsync call fails on these machines but it does not throw any error. We have wrapped it in try catch, assigned the call to a task and awaited the task. However, the task simply does not launch or complete at all. There is no log available. Nothing in the event viewer as well.
Here is the code snippet
try
{
_logger.LogInformation("Attempting to launch the window asynchronously!");
// This async call does not launch or probably never returns.
var createWindowTask = Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
Title = string.Empty,
WebPreferences = new WebPreferences
{
NodeIntegration = true,
DevTools = true,
AllowRunningInsecureContent = true,
EnableRemoteModule = true
}
});
var browserWindow = await createWindowTask;
if(createWindowTask.IsCanceled) _logger.LogInformation("Window creation is cancelled");
if(createWindowTask.IsCompleted) _logger.LogInformation($"Window creation task completed with status : {createWindowTask.Status}");
if (createWindowTask.Exception != null)
{
_logger.LogError($"Exception in creating App Window: {createWindowTask.Exception.Message}");
var innerExceptions = createWindowTask.Exception.InnerExceptions;
if (innerExceptions?.Count > 0)
{
foreach (var ex in innerExceptions)
{
_logger.LogError($"Inner Exception: {ex.Message}");
}
}
_logger.LogError($"No further Inner Exceptions");
}
_logger.LogInformation("Initializing App - Electron Bootstrap- Menu Bar init - Begin");
browserWindow.SetMenuBarVisibility(false);
_logger.LogInformation("Initializing App - Electron Bootstrap- Menu Bar init - End");
_logger.LogInformation("Initializing App - Electron Bootstrap- clear cache - Begin");
await browserWindow.WebContents.Session.ClearCacheAsync();
_logger.LogInformation("Initializing App - Electron Bootstrap- clear cache - End");
_logger.LogInformation("Initializing App - Electron Bootstrap- Init browser window show action - Begin");
browserWindow.OnReadyToShow += () => browserWindow.Show();
_logger.LogInformation("Initializing App - Electron Bootstrap- Init browser window show action - End");
}
catch (Exception ex)
{
_logger.LogCritical($"Error when starting the App. \n\tSource: {ex.Source}\n\tMessage : {ex.Message}\n\tInner Exception:{ex.InnerException?.Message}");
}
In the event viewer though we have found that the call to AppName.exe does not get called with --type=renderer parameter on these machine whereas on the other machines it does call with renderer parameter and the UI is visible.
We are not able to trace the root cause and as this is not running on client’s laptop, he is likely to cancel the project.
What we expect is to at least be able to get the root cause of the issue.
TIA
Hemant
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:23 (8 by maintainers)
Top GitHub Comments
@hemantsathe et al. I had a very similar issue recently where my electron.net was working for everyone but 2 machines. It turned out…localhost was being sent to their enterprise proxy for some dumb reason. The fix was to simply was for the user to add the environment variable “NO_PROXY” and that localhost is in its value.
NET6 support added in #636