Skip to content

ElectronNET app is not running when I`m adding services in .net core 6 #761

@YehorPavlenko

Description

@YehorPavlenko

My electron App is not running when I`m adding services in the Program file.

The program file looks like

using ElectronNET.API;

var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseElectron(args);

builder.Services.AddElectron();
builder.Services.AddControllersWithViews();
builder.Services.AddTransient<SomeInterface, SomeClass>();

var app = builder.Build();

if (!app.Environment.IsDevelopment())
{
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller}/{action=Index}/{id?}");

app.MapFallbackToFile("index.html"); 

await app.StartAsync();

await Electron.WindowManager.CreateWindowAsync();

app.WaitForShutdown();

But when I remove

builder.Services.AddTransient<SomeInterface, SomeClass>();

it runs perfectly.
Any ideas how to solve this?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions