When running MAUI app in .net 9 in debug it works but without debugging is not
Hi,
I moved from maui app in .NET 8 to .NET 9.
The project build but n debug it works but without debugging the login page is not opened.
I checked all nugets packages and moved to last.
================================
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.0" />
<PackageReference Include="System.Management" Version="9.0.1" />
<PackageReference Include="Telerik.UI.for.Maui" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Log4Net.AspNetCore" Version="8.0.0" />
<PackageReference Include="Autofac" Version="8.2.0" />
<PackageReference Include="DotNetZip" Version="1.16.0" />
</ItemGroup>
<!-- Windows -->
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) == true">
<PackageReference Include="WindowsAPICodePack" Version="8.0.6" />
</ItemGroup>
This is my xaml.cs
===========
public partial class App : Application
{
private static Mutex mutex = new Mutex(true, Assembly.GetEntryAssembly().GetName().Name);
public App()
{
if (!mutex.WaitOne(TimeSpan.Zero, true))
{
Current.Quit();
Environment.Exit(0);
}
InitializeComponent();
MainPage = new LoginPage();
}
protected override Window CreateWindow(IActivationState? activationState)
{
Window window = base.CreateWindow(activationState);
try
{
window.Stopped += async(s,e) =>
{
if (!string.IsNullOrEmpty(LoginConfigurations.GetInstance().SessionToken ))
{
var container = new Bootstrapper().Bootstrap();
IAutomationApiClient automationApiClient = container.Resolve<IAutomationApiClient>();
var results = await automationApiClient.PostLogOut($"{LoginConfigurations.GetInstance().Portal}/api/GSPortal/PostLogOut/false", LoginConfigurations.GetInstance().SessionToken);
if(results)
{
App.Current.Quit();
}
}
};
}
catch (Exception)
{
}
return window;
}
}
}
- I comment the mutex code + CreateWindow same problem.
How to solve the problem ?