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

AI Profiler not working well with .Net Core 3.0 and AKS #48

Closed
Eneuman opened this issue Oct 15, 2019 · 10 comments
Closed

AI Profiler not working well with .Net Core 3.0 and AKS #48

Eneuman opened this issue Oct 15, 2019 · 10 comments
Assignees
Labels
fix available Fix is checked into source control, ready to be released status: investigating Issue in investigating, fix not available yet.

Comments

@Eneuman
Copy link

Eneuman commented Oct 15, 2019

When using AI Profiler together with DEV-Spaces and AKS, I receive this error in my logs.

It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '2.0.0' was not found.
  - The following frameworks were found:
      3.0.0 at [/usr/share/dotnet/shared/Microsoft.NETCore.App]

You can resolve the problem by installing the specified framework and/or SDK.

The .NET Core frameworks can be found at:
  - https://aka.ms/dotnet-download
�[41m�[30mfail�[39m�[22m�[49m: ServiceProfiler.EventPipe.Client.TraceUploader.TraceUploaderProxy[0]
      Trace upload failed.

I am creating my docker container using this build file:

FROM mcr.microsoft.com/dotnet/core/sdk:3.0
ARG BUILD_CONFIGURATION=Debug
ENV ASPNETCORE_ENVIRONMENT=Development
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
ENV ASPNETCORE_URLS=http://+:80
EXPOSE 80

WORKDIR /src
COPY ["src/Test.Service/Test.Service.csproj", "src/Test.Service/"]

RUN dotnet restore "src/Test.Service/Test.Service.csproj"
COPY . .
WORKDIR "/src/src/Test.Service"
RUN dotnet build --no-restore "Test.Service.csproj" -c $BUILD_CONFIGURATION

RUN echo "exec dotnet run --no-build --no-launch-profile -c $BUILD_CONFIGURATION --" > /entrypoint.sh

ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]

I find it strange that it says that it has found .Net Core 3.0 but it needs .Net Core 2.0.
I am using the latest beta-2 package.

Any idea on how to solve this?

@xiaomi7732 xiaomi7732 self-assigned this Oct 16, 2019
@xiaomi7732
Copy link
Member

xiaomi7732 commented Oct 16, 2019

@Eneuman, thanks for the report. I'll take a look. I have a guess on what is happening but I will need to verify it. I'll post the cause here once I can root it.

@xiaomi7732 xiaomi7732 added the status: investigating Issue in investigating, fix not available yet. label Oct 16, 2019
@xiaomi7732
Copy link
Member

xiaomi7732 commented Oct 17, 2019

@Eneuman, the issue is that the TraceUploader in the package runs on .NET Core 2.x. This won't be an issue if there's .NET Core 2.x side by side with .NET Core 3.0. It is not the case in the container.

While we are looking into a proper fix, here's a workaround:

  1. Create a folder named 'Workaround' along side of the dockerfile in your project and put the following zip file into the folder:
    TraceUpload.zip

  2. Update the docker file to overwrite the existing TraceUpload.zip, the key is to stick it in to the correct folder after the publish:

...
RUN dotnet publish -c Release -o out
...
# Work around - output the new uploader for .NET Core 3.0
COPY ./Workaround/TraceUpload.zip ./out/ServiceProfiler/TraceUpload.zip
...

My full dockerfile just as an FYI:

FROM mcr.microsoft.com/dotnet/core/sdk:3.0 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Work around - output the new uploader for .NET Core 3.0
COPY ./Workaround/TraceUpload.zip ./out/ServiceProfiler/TraceUpload.zip

# Build runtime image
FROM mcr.microsoft.com/dotnet/core/aspnet:3.0

WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "ServiceProfiler.EventPipe.DockerApp30.dll"]

Give it a try and feel free to let us know if there's more issue.

@cwoolum
Copy link

cwoolum commented Oct 18, 2019

Manually copying the fixed app works for me. Couldn't TraceUpload just be as a standalone app so it doesn't require the .Net 2.2 framework?

@xiaomi7732
Copy link
Member

@cwoolum Thanks for the comment. It is good to know that we have a working workaround.
The trace upload is a standalone app but targeting NetCoreApp2.0.
We are working on a fix to simship for both runtimes.

@cwoolum
Copy link

cwoolum commented Oct 18, 2019

It would be great if the different versions could be hosted at a public endpoint and just added as a Dockerfile step. We actually add the profiler to one of our core libraries so our consuming apps actually need to have the zip manually added anyway.

We also use our own custom base docker images so downloading a file and adding it to the build as a step in the Dockerfile is much simpler than manually downloading the zip and copying it in.

@xiaomi7732
Copy link
Member

@cwoolum Thanks for the feedback. Will it work for you if we post the binaries for the uploader in Github releases?

@cwoolum
Copy link

cwoolum commented Oct 18, 2019

That would be the ideal solution for me!

@xiaomi7732
Copy link
Member

@xiaomi7732 xiaomi7732 added the fix available Fix is checked into source control, ready to be released label Oct 24, 2019
@xiaomi7732
Copy link
Member

@cwoolum
Copy link

cwoolum commented Oct 30, 2019

I'm able to easily pull the binaries. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix available Fix is checked into source control, ready to be released status: investigating Issue in investigating, fix not available yet.
Projects
None yet
Development

No branches or pull requests

3 participants