C
C#2y ago
Sergonizer

✅ Absolutely clueless about this nullreference exception

So I have this piece of code in my WPF+WCF application. For some reason I get an exception as "i" just doesnt exist ("sess[] was null"), no matter if it is a local variable inside brackets or placed like this. "users" is a list of arrays (chess game where 2 players are in one array).
13 Replies
ero
ero2y ago
sess is the one that's null
Sergonizer
SergonizerOP2y ago
well its not
ero
ero2y ago
it is
Sergonizer
SergonizerOP2y ago
ero
ero2y ago
there is no other possible explanation
Sergonizer
SergonizerOP2y ago
you see it just ignores i for some reason
Sergonizer
SergonizerOP2y ago
Sergonizer
SergonizerOP2y ago
I did rebuild the project
ero
ero2y ago
i'm not sure what you mean by "ignore" can you show the full error
Sergonizer
SergonizerOP2y ago
yeah just gotta change the lang to english ohhh i forgot how arrays work that the pointer is set to the 0 pos and if i empty it then the array will be null
Jimmacle
Jimmacle2y ago
an empty array and null array are not the same thing if that's what you're trying to say
Sergonizer
SergonizerOP2y ago
nonono i have a struct as the first element in the array and set this struct to null somewhere in the code so here i have the null as the array while the size is still 2
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server