Open Alois-xx opened 2 years ago
I have not had an issue running PerfViewCollect inside of Nano server containers recently. Can you share the error that you're seeing?
The ImageID issues that you're seeing are known and need to be addressed in the OS. I don't have an ETA on this, or know how it will be addressed yet though.
The error message is:
C:\C\Source\Git\perfView_Branch\perfview\src\PerfViewCollect\bin\Release\netcoreapp3.1\win-x64>PerfViewCollect.exe
Unhandled exception. System.PlatformNotSupportedException: The system does not support the STA thread apartment.
I have created a default .NET 6.0 Web Service where I have replaced the default image with the nano image:
#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/aspnet:6.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:6.0-nanoserver-1809 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["AspNetCoreWebAPI.csproj", "."]
RUN dotnet restore "./AspNetCoreWebAPI.csproj"
COPY . .
WORKDIR "/src/."
RUN dotnet build "AspNetCoreWebAPI.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "AspNetCoreWebAPI.csproj" -c Release -o /app/publish /p:UseAppHost=false
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "AspNetCoreWebAPI.dll"]
To get into the container with the self built binary I have used hcsdiag. Where I can search for the docker container ID which is the first part of the much longer hcsdiag container id. Then I can share folders and open a shell there.
Not sure if that is the recommended approach but that seems to be quick. Any pointers to a more docker like solutions are welcome.
C>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7238ffbe22fe aspnetcorewebapi:dev "C:\\remote_debugger\\…" 37 seconds ago Up 34 seconds 0.0.0.0:60416->80/tcp, 0.0.0.0:60415->443/tcp AspNetCoreWebAPI
C>hcsdiag list | findstr /i 7238ffbe22fe
7238ffbe22fe0b9216b0cc796dfdaca56826102a903248161ff58fa0e56435e9
C>hcsdiag share 7238ffbe22fe0b9216b0cc796dfdaca56826102a903248161ff58fa0e56435e9 C:\ C:\C
C>hcsdiag shell 7238ffbe22fe0b9216b0cc796dfdaca56826102a903248161ff58fa0e56435e9
Copyright (c) Microsoft Corporation. All rights reserved.
The number of people using this seems to be near zero. @brianrob: Would it help if I create an official issue for enterprise customers with regards to the ImageID events? At some point ETW tracing is needed and I have no idea how one is supposed to get profiling data from a Windows Container running .NET Core 6.0 or later. If this ever hits production in the current state we will have huge issues.
Thanks for sharing this. You are welcome to create an issue regarding the ImageID events. I have sent an e-mail to check on status, but feel free to file something if you like.
Regarding the threading issue, I have not seen this, but your PR to not use STA threads seems like a reasonable way to fix this, given that there's no GUI anyway.
Has this ever anyone tried? Server Nano does not support STA Threads. The workaround is to switch to MTA. I can provide a PR? Who is using this? Also I have problems to resolve the image id events, because the docker for Windows containers use a vmsmb folder path which cannot be resolved?
Is anyone using ETW inside windows containers?