Naweed Akram
Naweed Akram

Reputation: 115

ArgumentNull_Generic error in UWP app

I am facing a strange issue in one of my UWP apps. I have over 12,000 installs of this application and only few users (may be 5-6 of them) have reported this issue. It happens mostly on Windows Mobile, but also there have been reports of this error on Windows 10 Desktop.

The error message is: ArgumentNull_Generic Arg_ParamName_Name, source. For more information, visit http://go.microsoft.com/fwlink/?LinkId=623485

I am not able to get this error at all, so I have no clue what to even look for. Usually for my users, I ask them to un-install and re-install the app, and this resolves the issue for them. But also to note, for these users, this problem keeps coming back every 4-5 days, and they have to un-install and re-install to get the problem fixed.

Any idea. My app in question is: https://www.microsoft.com/en-us/store/apps/series-tracker/9nblggh3slj9

Thanks

Upvotes: 3

Views: 2037

Answers (1)

F Chopin
F Chopin

Reputation: 728

This error happened for me when calling:

if (myObject.ArrayProperty.Any())

Where myObject has the following type:

public class MyObjectModel
{
    public MyArrayModel[] ArrayProperty { get; set; } = [];
}

It happened when calling .Any() in the case where ArrayProperty was actually null.

Changing it to:

public class MyObjectModel
{
    public MyArrayModel[]? ArrayProperty { get; set; }
}

And then changing the if to:

if (myObject.ArrayProperty != null && myObject.ArrayProperty.Any())

Solved the issue.

Upvotes: 0

Related Questions