I have a C# app which is launched by another C++ exe.
The c# is a debug build.
When using .Net Framework 4.7 the Debug.Assert(false) would always show a dialog giving me a chance to attach a debugger.
Now I'm using .NET 9 and the Debug.Assert(false) no longer shows a dialog. So I don't get a chance to attach a debugger.
What is the best way to to pause my c# app so I can attach a debugger?
The options seem to be doing a Sleep or showing a MessageBox OK, Cancel
This is what I have resorted to
#if DEBUG
MessageBox.Show("Attach debugger", "Title", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
#endif
Is there anything better?
Debugger.Launch()- and one of the answers in the link you posted has a suggestion too.