theolivenbaum/electron-sharp

problem with 26.0.0.40902 and new

Closed this issue · 1 comments

Cav-jj commented

I have probem with 26.0.0.40902 and newer

When I do start or build the dotnet blazor server won't start in background it says

Electron Socket IO Port: 8000
Electron Socket started on port 8000 at ::1
.NET Core Port: undefined
stdout: Use Electron Port: 8000

but when i use version 25.3.1.40533 it get a output

Electron Socket IO Port: 8000
Electron Socket started on port 8000 at ::1
.NET Core Port: 8001
stdout: Use Electron Port: 8000

code
var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
}

app.UseStaticFiles();

app.UseRouting();

app.MapBlazorHub();
app.MapFallbackToPage("/_Host");

if (HybridSupport.IsElectronActive)
Electronize(browserWidth, browserHeight, BrowserFullScreen);

app.Run();

void Electronize(int width = 0, int height = 0, bool fullScreen = false)
{
int standardWidth = 800;
int standardHeight = 600;

try
{
    Electron.ReadAuth();

    // Remove Electrons menus
    Electron.Menu.SetApplicationMenu(Array.Empty<MenuItem>());

    var options = new BrowserWindowOptions
    {
        Width = width > standardWidth ? width : standardWidth,
        Height = height > standardHeight ? height : standardHeight,
        MinWidth = standardWidth,
        MinHeight = standardHeight,
        Fullscreen = fullScreen,
        Center = true
    };

    Task.Run(async () =>
    {
        var window = await Electron.WindowManager.CreateWindowAsync(options);
        window.OnClosed += () => Electron.App.Quit();
    });
}
catch (Exception exeption) { Console.WriteLine(exeption.Message); }

}

version
dotnet = 7.0.402
node = 20.8.1
npm = 10.1.0

  • Target:
  • windows/linux

"aspCoreBackendPort": "random", added to electron.manifest.json it works