[view models / page structuring series] Warnings flood my markup when I use nullable view models

(taken from here: Simple validation crashing on just one property (+other validation issues)

PS 2:
This unfortunately blows up exponentially very easily and a nullable disabled context is certainly not an option for us.


I am not able do obtain progress with trying to disable the warnings, even though it is not to be desired to disable them in the view model:

#pragma warning disable CS8600
#pragma warning disable CS8602

Putting [NotNull] on properties in view model makes the markup warnings disappear but, of course, they also disappear in the view model file.



This eliminates all warnings from the MarkupControl markup.

:question: how do I disable specifically only for .dothtml and .dotcontrol files?

UPDATE on disabling for specific files:

Not able to do anything with the approach posted here: https://stackoverflow.com/a/70755376/2603874


.editorconfig rules look like are ignored for DotVVM specific markup files (I tried various alternatives) while they do have effect on .cs files. So… I don’t know.

This is essentially the same problem as [Validation series] Required validation for int? property gives warnings in markup, right?

I don’t know, I reported it to the VS Extension yesterday. I don’t use Visual Studio, but I doubt you can easily work around it, I think it will have to be fixed by us

1 Like

Yes, they are the same. Good catch! And sorry, I’ve missed that - lots of stuff happening here these days.

no problem, I was just wondering I should report this one as another issue

1 Like

UPDATE :hushed:

In a now decently 300 count of wide-rows markup:

While developing I tend to disable the warning for obvious reasons but if I get in the habbit of keeping it disabled, when I enable it again I have surprise work to do in code-behind in many places in a refactor/backtrack kinda way.