You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actual Behavior:
it's all good, acessing MyProperty trows NRE.
Notes
I understand that by definition nullability analysis has holes. One could e.g. create an array of such structs (or generally initialization of arrays is a problem), we could be in generic type situation, etc.
And also understand that plugging even this generally would probably require adding a notion of non-default-initialized struct and flow that through analysis or some way to disallow usage of default generated constructor (maybe warn if there's one autogenerated on struct with non-nullable fields?) to fix situations s.a. with initialization of field on class.
But plugging at least the case where we explicitly pass default to such variable should be possible .
The text was updated successfully, but these errors were encountered:
Version Used:
Latest
Steps to Reproduce:
object MyProperty
A minimal repro, with source-code provided, is ideal:
https://sharplab.io/#v2:C4LgTgrgdgNAJiA1AHwAICYCMBYAUKgZgAJVMA2E9IgYSIG88inKqHdmOiA3AQzCIBGRALxE4AUwBmPCABtgACgBCASgDcjTkwEA6ALIBPAApgA9gAdxYYAZ0AVUwGVgYAJZQA5gvWamAX18iPADcPDBxHjhTKFkDInCAY1MwOCIAZxcIBOAiJQVTAQArcWyiQxMLKxt1IA=
Expected Behavior:
Some sort of warning happens.
Actual Behavior:
it's all good, acessing MyProperty trows NRE.
Notes
I understand that by definition nullability analysis has holes. One could e.g. create an array of such structs (or generally initialization of arrays is a problem), we could be in generic type situation, etc.
And also understand that plugging even this generally would probably require adding a notion of non-default-initialized struct and flow that through analysis or some way to disallow usage of default generated constructor (maybe warn if there's one autogenerated on struct with non-nullable fields?) to fix situations s.a. with initialization of field on class.
But plugging at least the case where we explicitly pass default to such variable should be possible .
The text was updated successfully, but these errors were encountered: