Skip to content
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

(Guidance 2022.2.1.14) IndexOutOfRangeException in Blazor web app About page #238

Open
HaGGi13 opened this issue May 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@HaGGi13
Copy link

HaGGi13 commented May 7, 2024

Describe the bug

A new generated Blazor web app targeting environment Germany generated, throws an exception on navigating to the About page by selecting the "About" menu entry.
This is caused, because the default localization resource file About.resx contains a value that cannot be parsed. In concrete, the resource cultures contains the value cultures, but as the code tries to split the value first by ; (semi-colon) and than by , (comma) this will result in an empty array that is tried to access directly via index.
This is throwing in an out of bound exception in file About.razor in line 34.

I didn't verified this for Belgium targeting projects, but I expect the same behavior there too.

To Reproduce

TL;DR - Steps to reproduce the behavior

  1. Ensure browser cache (local storage + cookies) were deleted
    • Otherwise possible already selected culture will be used instead of default/fallback
  2. Select "About" page in web app

Super detailed - Steps to reproduce the behavior:

  1. Generate empty solution incl. YARP
  2. Generate backend service
  3. Generate Blazor web app
  4. Register all components in indentity service for being able to authenticate and run the skeleton
  5. Run all three components in debug mode out of Visual Studio or deploy it on a server
  6. If not in debug mode in Visual Studio: Navigate to web app
  7. Open Edge F12 developer tools and select tab "Console"
  8. Ensure browser cache (local storage + cookies) were deleted
    • Otherwise possible already selected culture will be used instead of default/fallback
  9. In web app click menu entry "About"
  10. In F12 Tools see errors listed and in web app see error at the bottom of the screen

Expected behavior

There's no exception thrown and either the language selection buttons appear or not, depending on the resource file for localization selected.

Screenshots

Exception in web app:
image

About.resx cultures value:
image

Desktop (please complete the following information)

  • .NET SDK v8.0.200
  • Guidance v2022.2.1.14
  • Arc4u v8.1.0
  • Nova v2.3.4-rc4
@vvdb-architecture
Copy link
Contributor

Duplicate of #77 , but much better explained!

@rdarko rdarko added the bug Something isn't working label May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants