Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application starts but window does not open. #25

Open
flambert860 opened this issue Jan 28, 2024 · 2 comments
Open

Application starts but window does not open. #25

flambert860 opened this issue Jan 28, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@flambert860
Copy link

Versions:
npm: 21.6.1 & 18.11.0
node:21.6.1
ElectronSharp.API: 28.2.0.44969
.Net8
VSStudio:17.9.0 preview 4 & 17.8.5

Target: win10

Projects: bare minimum & sample project

Issue when running command "electron-sharp start"
it does not report any errors and keep the console "active" but no window appears.

`PS C:\Users\xxxx\source\repos\ElecSharp\ElecSharp> electron-sharp start
Start Electron Desktop Application...
Arguments:

Running command: 'dotnet publish -r win-x64 -c "Debug" --output "C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host\bin" /p:PublishReadyToRun=false /p:PublishSingleFile=false --no-self-contained /p:DisabledWarnings=true' on folder 'C:\Users\xxxx\source\repos\ElecSharp\ElecSharp'
dotnet publish -r win-x64 -c "Debug" --output "C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host\bin" /p:PublishReadyToRun=false /p:PublishSingleFile=false --no-self-contained /p:DisabledWarnings=true
MSBuild version 17.9.0-preview-23618-08+82d381eb2 for .NET
Determining projects to restore...
All projects are up-to-date for restore.
c:\program files\dotnet\sdk\8.0.200-preview.23624.5\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(311,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy [C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\ElecSharp.csproj]
ElecSharp -> C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\bin\Debug\net8.0\win-x64\ElecSharp.dll
ElecSharp -> C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host\bin\

Found resource : ElectronSharp.CLI.ElectronHost.electron.manifest.json
Found resource : ElectronSharp.CLI.ElectronHost.package.json
Found resource : ElectronSharp.CLI.ElectronHost.ElectronHostHook.tsconfig.json
Found resource : ElectronSharp.CLI.ElectronHost.ElectronHostHook.package.json
Found resource : ElectronSharp.CLI.ElectronHost.main.js
Found resource : ElectronSharp.CLI.ElectronHost.build-helper.js
Found resource : ElectronSharp.CLI.ElectronHost.api.ipc.js
Found resource : ElectronSharp.CLI.ElectronHost.api.app.js
Found resource : ElectronSharp.CLI.ElectronHost.api.browserWindows.js
Found resource : ElectronSharp.CLI.ElectronHost.api.commandLine.js
Found resource : ElectronSharp.CLI.ElectronHost.api.dialog.js
Found resource : ElectronSharp.CLI.ElectronHost.api.dock.js
Found resource : ElectronSharp.CLI.ElectronHost.api.menu.js
Found resource : ElectronSharp.CLI.ElectronHost.api.notification.js
Found resource : ElectronSharp.CLI.ElectronHost.api.tray.js
Found resource : ElectronSharp.CLI.ElectronHost.api.globalShortcut.js
Found resource : ElectronSharp.CLI.ElectronHost.api.desktopCapturer.js
Found resource : ElectronSharp.CLI.ElectronHost.api.screen.js
Found resource : ElectronSharp.CLI.ElectronHost.api.shell.js
Found resource : ElectronSharp.CLI.ElectronHost.api.webContents.js
Found resource : ElectronSharp.CLI.ElectronHost.api.clipboard.js
Found resource : ElectronSharp.CLI.ElectronHost.api.autoUpdater.js
Found resource : ElectronSharp.CLI.ElectronHost.api.browserView.js
Found resource : ElectronSharp.CLI.ElectronHost.api.powerMonitor.js
Found resource : ElectronSharp.CLI.ElectronHost.api.nativeTheme.js
Found resource : ElectronSharp.CLI.ElectronHost.ElectronHostHook.index.ts
Found resource : ElectronSharp.CLI.ElectronHost.ElectronHostHook.connector.ts
Found resource : ElectronSharp.CLI.ElectronHost.ElectronHostHook..gitignore
Found resource : ElectronSharp.CLI.ElectronHost.splashscreen.index.html
node_modules in: C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host\node_modules
Start npm install...
Running command: 'npm install' on folder 'C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host'
npm install

changed 1 package, and audited 245 packages in 16s

54 packages are looking for funding
run npm fund for details

found 0 vulnerabilities

ElectronHostHook handling started...
Invoke electron.cmd - in dir: C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host\node_modules.bin


Running command: 'electron.cmd "....\main.js" ' on folder 'C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host\node_modules.bin'
electron.cmd "....\main.js"

Electron Socket IO Port: 8000
Electron Socket started on port 8000 at ::1
.NET Core Port: undefined
stdout: info: Microsoft.Hosting.Lifetime[14]

stdout: info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.

stdout: info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: C:\Users\xxxx\source\repos\ElecSharp\ElecSharp\obj\Host\bin`

@flambert860 flambert860 added the bug Something isn't working label Jan 28, 2024
@ErikApption
Copy link
Contributor

Same with the sample app and main branch with dotnet 8

@Tartilla-TAIGO
Copy link
Contributor

Tartilla-TAIGO commented Jul 25, 2024

Use this code. Please note that you need to use first Electron.ReadAuth(); This code works for Blazor NET 8.0

using ElectronSharp.API;
using ElectronSharp.API.Entities;
Electron.ReadAuth();

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.WebHost.UseElectron(args);
var app = builder.Build();
if (!app.Environment.IsDevelopment())
    app.UseExceptionHandler("/Error", createScopeForErrors: true);
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<BlazorApp1.Components.App>().AddInteractiveServerRenderMode();

var browserWindow = await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions
{
    Width = 1152,
    Height = 940,
});
await app.RunAsync();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants