visual studio code value does not fall within the expected range "code generation" code example
Example: value does not fall within the expected range visual studio
For me Fixed : I just had the same, it was only one file which casing this issue,
When I read the solution above I was worried to fix all visual studio
because one .cs file so I tried to right click on the (TAB header)
beside the (X) button which closes this and click on (Close All documents)...
it worked : )