GFlisch / Arc4u.Guidance.Doc

Other
5 stars 1 forks source link

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

Open HaGGi13 opened 2 months ago

HaGGi13 commented 2 months ago

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)

vvdb-architecture commented 2 months ago

Duplicate of #77 , but much better explained!