Hello @RogerSchlueter-7899 ,
Thanks for your question.
WPF starts reading those 89 items to generate the visual UI in the background. If there is a binding error, a bad data format in one of the properties, or a threading issue during that render, WPF will suffer a fatal crash after your End Sub completes. Because this happens deep in the presentation framework, Visual Studio sometimes misses it with default settings, and the app terminates silently.
I recommend some following steps:
- Force Visual Studio to break on all exceptions.
By default, Visual Studio might continue past certain background exceptions. You can force the debugger to halt the exact millisecond the crash happens.
- Go to Debug > Windows > Exception Settings in your top menu.
- Check the box next to Common Language Runtime Exceptions.
- Run the app again to see if it stops and highlights the internal error.
- If Visual Studio still doesn't catch the crash, the Windows operating system definitely recorded it.
- Open the Event Viewer app on your Windows PC.
- Navigate to Windows Logs > Application.
- Look for a red error or .NET runtime error at the exact timestamp your app closed. The details pane will usually contain the exact exception message.
- WPF provides a built-in safety net for catching errors that happen on the main UI thread. You can add a DispatcherUnhandledException handler in your
App.xaml.vb file to catch these silent crashes and display them in a message box before the app closes.
I hope this addresses your question. If this response was helpful, please consider following the guidance to provide feedback.