Why do i get Null Reference Error's suddenly even when the same code worked perfectly before

201 Views Asked by At

I have an WPF application using MVVM with PRISM. I'm also using DevExpress for this project. The application has 10 modules. And everything worked well. The application is in production. After opening the source in Visual Studio 2019 yesterday i'm getting all kinds of NullReferenceExceptions on the SelectedItem of the DevExpress GridControl. The application uses the SelectedItem to publish events using EventAggregator (PRISM). so i get errors here. I have done nothing to explain this behaviour. The only thing i can think of is that i had a power failure and after reopening the solution i started getting these errors. Does this have to do with an update i don't know of? I'm using .NET Framework 4.7.2. Prism 6, DevExpress 20 Can anyone help?

1

There are 1 best solutions below

0
Ricardo Dias Morais On

You can try to delete bin and obj folders from your project folder, it usually does the trick, if that doesn't work, you can try to Restore the Nugget Packages.

1 - Enable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages.

2 - In Solution Explorer, right click the solution and select Restore NuGet Packages.