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

Any (even wrapped at try..catch) exception at .net9-macos TFM terminates application in debug build configuration #21705

Open
yevgeny-sotnikov opened this issue Nov 28, 2024 · 2 comments
Labels
need-attention An issue requires our attention/response
Milestone

Comments

@yevgeny-sotnikov
Copy link

yevgeny-sotnikov commented Nov 28, 2024

Apple platform

macOS

Framework version

net9.0-*

Affected platform version

.net 9.0.100

Description

In debug build app instantly crashes even on expected exceptions wrapped to try-catch block.

No any information neither in debug output, nor at AppDomain.CurrentDomain.UnhandledException handler.

App crashes without any notification what's happening. On real project it's real problem cuz it blocks development

Steps to Reproduce

  1. Pull https://github.com/yevgeny-sotnikov/dotnet-issues
  2. Checkout macos-instant-crash-in-debug-config branch
  3. Run sample app

Did you find any workaround?

No

Relevant logs

No response

@rolfbjarne
Copy link
Member

I can't reproduce any crashes.

I build like this:

$ dotnet build

and then I run from the command line like this:

$ ./bin/Debug/net9.0-macos/osx-arm64/macOSApp1.app/Contents/MacOS/macOSApp1
2024-11-29 22:10:40.716 macOSApp1[39062:3937935] Microsoft.macOS: Invalid IDE Port: -1
2024-11-29 22:10:41.397 macOSApp1[39062:3937904] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
macOSApp1.MyException: I want to get this exception at least at console output, also, i need to handle this exception - app shouldn't crash
   at macOSApp1.AppDelegate.DidFinishLaunching(NSNotification notification) in [...]/dotnet-issues/macOSApp1/AppDelegate.cs:line 14

and the app doesn't crash.

How are you launching the app?

@rolfbjarne rolfbjarne added the need-info Waiting for more information before the bug can be investigated label Nov 29, 2024
@rolfbjarne rolfbjarne added this to the Future milestone Nov 29, 2024
@yevgeny-sotnikov
Copy link
Author

yevgeny-sotnikov commented Nov 30, 2024

How are you launching the app?

I'm running debug build at Rider/VSCode, doesn't matter, with attached debugger. The problem is when execution reaches exception throwing - after that app instantly stops execution and debugger never reach breakpoint at catch block.

Screenshot 2024-11-30 at 11 28 55

By now in this small sample i know what is root cause of such behaviour, but in real, big solution i spent few hours to find root cause, cuz no any information about exception in debug output. To be honest - at this case app mustn't crash at all cuz exception is catched

With .net8 i don't have such issue - all works as expected

@microsoft-github-policy-service microsoft-github-policy-service bot added need-attention An issue requires our attention/response and removed need-info Waiting for more information before the bug can be investigated labels Nov 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-attention An issue requires our attention/response
Projects
None yet
Development

No branches or pull requests

2 participants