Hello,
Welcome to Microsoft Q&A.
In the process of creating applications, null references are a common exception. This requires developers to consider the situation where variables are null as fully as possible when writing code.
If a customer reports a problem with a null reference, you can follow the steps below (Just some suggestions):
- Ask the customer about the steps to reproduce the problem, and try to reproduce it locally to locate the problem.
- Review the code after fixing the problem, or create a separate unit test module for testing.
In UWP, you can also listen to the UnhandledException
event in App.xaml.cs. For most runtime errors, it will eventually bubble up here. After obtaining the error information, you can perform local logging for subsequent repairs:
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
this.UnhandledException += OnUnhandledException;
}
private void OnUnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
{
e.Handled = true;
// handle with e.Exception
}
Thanks.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.