ardalis / pluralsight-ddd-fundamentals

Sample code for the Pluralsight DDD Fundamentals course by Julie Lerman and Steve "ardalis" Smith

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to use Schedule app.

quain24 opened this issue · comments

After initial docker setup, with all containers running, when firing up the http://localhost:5100/
I'm welcomed with following exception in browser's console:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: String '09/23/2030 00:00:00 -04:00' was not recognized as a valid DateTime.
System.FormatException: String '09/23/2030 00:00:00 -04:00' was not recognized as a valid DateTime.
   at System.DateTimeParse.Parse(ReadOnlySpan`1 s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.DateTime.Parse(String s)
   at System.Convert.ToDateTime(String value)
   at FrontDesk.Blazor.Services.ConfigurationService.ReadAsync()
   at FrontDesk.Blazor.Pages.Index.OnInitializedAsync()
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle)

In addition:
obraz

Interesting. I guess somehow the docker container is picking up a datetime format preference from your host OS, so 9/23/2030 is being interpreted as the 9th day of the 23rd month.

Could be related: dotnet/runtime#42328
Could be used to specify locale: https://stackoverflow.com/questions/28405902/how-to-set-the-locale-inside-a-debian-ubuntu-docker-container

Is anyone else (probably in a locale that uses day/month/year) seeing this?

Unfortunately I was unable to fix this issue with provided help, although I am a beginner when it comes to docker / containers / etc.
I tried to modify Dockerfile of ddd.clientmanager.blazor as follows:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/sdk:5.0.100-rc.1-buster-slim AS build
WORKDIR /app

RUN apt-get update && apt-get install -y locales && rm -rf /var/lib/apt/lists/* \
 && locale-gen "en_US.UTF-8"
ENV LANG=en_US.UTF-8 \
    LANGUAGE=en_US:en \
    LC_ALL=en_US.UTF-8

COPY FrontDesk/src/FrontDesk.Blazor ./FrontDesk.Blazor
COPY FrontDesk/src/BlazorShared ./BlazorShared
RUN dotnet restore /app/FrontDesk.Blazor/FrontDesk.Blazor.csproj

WORKDIR /app/FrontDesk.Blazor
RUN dotnet build -c Release -o /bin/Release/net5.0

FROM build AS publish
RUN dotnet publish -c Release -o /bin/Release/net5.0/browser-wasm/publish

FROM nginx:alpine AS final

WORKDIR /usr/share/nginx/html

COPY --from=publish /bin/Release/net5.0/browser-wasm/publish/wwwroot /usr/local/webapp/nginx/html
COPY --from=build /bin/Release/net5.0/nginx.conf /etc/nginx/nginx.conf
EXPOSE 80

Are you able to build locally? Docker is an option, and usually an easier one, but not the only one.

Yes, with suggested rabbit-mq container spun up I am able to run FrontDesk.Blazor from VS.
My main concern is that I wanted to see all of this working as one, as presented in Your Pluralsight course.

You can do that by just having multiple visual studio instances (or terminals) running, and run each of the apps on their own ports. The table in the README shows the ports that should be in use when you do this yourself vs. in docker. When I'm working with it locally and troubleshooting, debugging, or even developing this is how I run it.

I think this is now fixed - let me know if it's still an issue.