dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.19k stars 9.93k forks source link

Hot Reload does not work when running dotnet blazorwasm app in container #40473

Open SnoCold opened 3 years ago

SnoCold commented 3 years ago

Hey All, just wanted to ask if this is a known issue or I am doing something wrong as there are not enough resources online.

Here is my Dockerfile

ARG REPO=mcr.microsoft.com/dotnet/aspnet
FROM $REPO:6.0.0-preview.7-focal-amd64

ENV \
  # Unset ASPNETCORE_URLS from aspnet base image
  ASPNETCORE_URLS=http://+:80 \
  # Do not generate certificate
  DOTNET_GENERATE_ASPNET_CERTIFICATE=false \
  # Do not show first run text
  DOTNET_NOLOGO=true \
  # SDK version
  DOTNET_SDK_VERSION=6.0.100-preview.7.21379.14 \
  # Enable correct mode for dotnet watch (only mode supported in a container)
  DOTNET_USE_POLLING_FILE_WATCHER=true \
  # Unset Logging__Console__FormatterName from aspnet base image
  Logging__Console__FormatterName= \
  # Skip extraction of XML docs - generally not useful within an image/container - helps performance
  NUGET_XMLDOC_MODE=skip \
  # PowerShell telemetry for docker image usage
  POWERSHELL_DISTRIBUTION_CHANNEL=PSDocker-DotnetSDK-Ubuntu-20.04

RUN apt-get update \
  && apt-get install -y --no-install-recommends \
  curl \
  git \
  wget \
  && rm -rf /var/lib/apt/lists/*

# Install .NET SDK
RUN curl -SL --output dotnet.tar.gz https://dotnetcli.azureedge.net/dotnet/Sdk/$DOTNET_SDK_VERSION/dotnet-sdk-$DOTNET_SDK_VERSION-linux-x64.tar.gz \
  && dotnet_sha512='c8757325407b5eb1e3870f0db87eeaf44df978313c0b2a7f465ec7d0a5647317cba597264ec81577ea0b3bd97bd33d782234392e8e592e073126792a0406df7b' \
  && echo "$dotnet_sha512  dotnet.tar.gz" | sha512sum -c - \
  && mkdir -p /usr/share/dotnet \
  && tar -C /usr/share/dotnet -oxzf dotnet.tar.gz ./packs ./sdk ./sdk-manifests ./templates ./LICENSE.txt ./ThirdPartyNotices.txt \
  && rm dotnet.tar.gz \
  # Trigger first run experience by running arbitrary cmd
  && dotnet help

# Install PowerShell global tool
RUN powershell_version=7.2.0-preview.8 \
  && curl -SL --output PowerShell.Linux.x64.$powershell_version.nupkg https://pwshtool.blob.core.windows.net/tool/$powershell_version/PowerShell.Linux.x64.$powershell_version.nupkg \
  && powershell_sha512='cf3b6415fdad38dd582c57b2df06a28528d6243af508626fb20de36116993fd2bb7e73a8869f07b787c73eb920c2559e8a2c2611173a26d2d227d36de08cbc71' \
  && echo "$powershell_sha512  PowerShell.Linux.x64.$powershell_version.nupkg" | sha512sum -c - \
  && mkdir -p /usr/share/powershell \
  && dotnet tool install --add-source / --tool-path /usr/share/powershell --version $powershell_version PowerShell.Linux.x64 \
  && dotnet nuget locals all --clear \
  && rm PowerShell.Linux.x64.$powershell_version.nupkg \
  && ln -s /usr/share/powershell/pwsh /usr/bin/pwsh \
  && chmod 755 /usr/share/powershell/pwsh \
  # To reduce image size, remove the copy nupkg that nuget keeps.
  && find /usr/share/powershell -print | grep -i '.*[.]nupkg$' | xargs rm

I also added the "hotReloadProfile" : "blazorwasm" in launchSettings.json, so I get the "Hot Reloading is Enabled" message

I am using the Vscode Remote Container development feature to open a folder in a container. (Default Settings) created app using

dotnet new blazorwasm -o MyApp
cd MyApp
dotnet restore
dotnet watch run

Steps:

Try changing a CSS file

Expected:

Change reflected in UI

Actual:

no change is seen in the web app, not even after refreshing the page

Edit: Code changes in Razor pages work, but css modifications don't reflect even though this message is printed

File changed: /workspaces/Project/Maybe/Shared/MainLayout.razor.css.
watch : Hot reload of scoped css succeeded.
mkArtakMSFT commented 2 years ago

Thanks for contacting us. This is not something we support currently.

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.