Getting ArgumentOutOfRangeException on line with no collection, argument or index! #8419
Replies: 1 comment
-
|
Not a question about the design of the c# language. You could try stack overflow. Or one of the discord channels linked to from dotnet/Roslyn. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Razor Pages web application (.NET 8.0) with the following code in my markup.
It's possible for
Model.DepartTruck.ProductSourcesto be empty. That is the reason for thisifstatement. However, when I run it, anArgumentOutOfRangeExceptionis thrown.In this case,
Model.DepartTruck.ProductSourcesis empty andiis zero. So why the exception? And look at the line where the exception occurs! The highlighted line has no collection, no argument and no index.Modelis my page model. AndIsStorageis a publicboolvariable in the model.Does anyone know why I am seeing this?
Beta Was this translation helpful? Give feedback.
All reactions