-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
AppDomain.CurrentDomain.ProcessExit
is not called on macOS (maccatalyst) in MAUI app
#78911
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to 'os-maccatalyst': @steveisok, @akoeplinger Issue DetailsDescriptionI have tried to register the Filed also as: dotnet/maui#11676, @rolfbjarne suggested that this might be a dotnet/runtime repo so I took the opportunity to file the issue here. I'm sorry if this is not correct place. Feel free to close the issue if it does not belong here. Reproduction StepsModify a sample MAUI app as follows: using System;
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new AppShell();
AppDomain.CurrentDomain.ProcessExit += this.OnProcessExit; // Added line.
}
// This method is not called on macOS but it is called on Windows.
private void OnProcessExit(object sender, EventArgs e)
{
throw new Exception("REACHED?");
}
} Expected behaviorI expect Actual behavior
Interestingly though, in a standard .NET console app on macOS (i.e public static class Program
{
public static void Main(string[] args)
{
AppDomain.CurrentDomain.ProcessExit += CurrentDomain_ProcessExit;
}
private static void CurrentDomain_ProcessExit(object? sender, EventArgs e)
{
throw new NotImplementedException();
}
} So the issue seems to be MAUI specific. Regression?No response Known WorkaroundsI have not found any. ConfigurationmacOS M1, .NET 7 (i.e. latest released version) Other informationNo response
|
@steveisok @akoeplinger Any progress on this one please? Anything I can help with potentially? |
@akoeplinger Please take a look at this when you have a moment. |
Description
I have tried to register the
AppDomain.CurrentDomain.ProcessExit
event in my MAUI app running on macOS (maccatalyst) but the event is not fired. However, when the same app is run on Windows, the event is fired.Filed also as: dotnet/maui#11676, @rolfbjarne suggested that this might be a dotnet/runtime repo so I took the opportunity to file the issue here. I'm sorry if this is not correct place. Feel free to close the issue if it does not belong here.
Reproduction Steps
Modify a sample MAUI app as follows:
Expected behavior
I expect
OnProcessExit
to be called.Actual behavior
OnProcessExit
method is NOT called.Interestingly though, in a standard .NET console app on macOS (i.e
net7.0
),CurrentDomain_ProcessExit
is called:So the issue seems to be MAUI specific.
Regression?
No response
Known Workarounds
I have not found any.
Configuration
macOS M1, .NET 7 (i.e. latest released version)
Other information
No response
The text was updated successfully, but these errors were encountered: