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.ProductSources
to be empty. That is the reason for thisif
statement. However, when I run it, anArgumentOutOfRangeException
is thrown.In this case,
Model.DepartTruck.ProductSources
is empty andi
is 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.Model
is my page model. AndIsStorage
is a publicbool
variable in the model.Does anyone know why I am seeing this?
Beta Was this translation helpful? Give feedback.
All reactions