Skip to content

var is not local. (Blazor) #10327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Pentadome opened this issue May 17, 2019 · 2 comments
Closed

var is not local. (Blazor) #10327

Pentadome opened this issue May 17, 2019 · 2 comments
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@Pentadome
Copy link

If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to [email protected]. Your report may be eligible for our bug bounty but ONLY if it is reported through email.

Describe the bug

A clear and concise description of what the bug is.
@for (var i = 1; i < int_amount_of_pages + 1; i++) { var intpagenr = i; <li class="page-item"><a class="page-link" value="@i" onclick="@(() => SetPageNR( intpagenr.ToString()))"> @i.ToString()</a></li> }

If 'int_amount_of_pages ' is 5, 'i' will always be 6 when given as an argument to 'SetPageNR', Only when you declare a local variable, equate it to 'i' and then give that as an argument is the expected behavior executed.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core '...'
    3.0 preview-5
  2. Run this code '....'
    see above
  3. With these arguments '....'
    see above
  4. See error
    unexpected behavior

Expected behavior

A clear and concise description of what you expected to happen.
i is not the max i was + 1, i is what it was when it went through that loop.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.
Include the output of dotnet --info

@Eilon Eilon added the area-blazor Includes: Blazor, Razor Components label May 17, 2019
@mkArtakMSFT
Copy link
Contributor

Thanks for contacting us. We believe that the question you've raised have been answered. If you still feel a need to continue the discussion, feel free to reopen it and add your comments.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

4 participants