Skip to content

Commit 09a206f

Browse files
authored
Update dotnet example (#54)
1 parent a1a13a9 commit 09a206f

File tree

5 files changed

+23
-20
lines changed

5 files changed

+23
-20
lines changed

dotnet/Dockerfile

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS base
1+
FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
22
WORKDIR /app
33

44
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
55
# For more info, please refer to https://aka.ms/vscode-docker-dotnet-configure-containers
66
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
77
USER appuser
88

9-
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
9+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
1010
WORKDIR /src
1111
COPY ["demo.csproj", "./"]
1212
RUN dotnet restore "demo.csproj"
@@ -18,7 +18,6 @@ FROM build AS publish
1818
RUN dotnet publish "demo.csproj" -c Release -o /app/publish
1919

2020
FROM base AS final
21-
ENV DOTNET_PerfMapEnabled=1
2221
WORKDIR /app
2322
COPY --from=publish /app/publish .
2423
ENTRYPOINT ["dotnet", "demo.dll"]

dotnet/Program.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ namespace Demo
44
{
55
class Program
66
{
7-
static int Fibonacci(int n)
7+
static long Fibonacci(int n)
88
{
9-
int a = 0, b = 1, tmp;
9+
long a = 0, b = 1, tmp;
1010

1111
for (int i = 0; i < n; i++)
1212
{
@@ -22,7 +22,7 @@ static void Main(string[] args)
2222
{
2323
while (true)
2424
{
25-
Console.WriteLine(Fibonacci(42));
25+
Console.WriteLine(Fibonacci(1000000000));
2626
}
2727
}
2828
}

dotnet/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# .NET
22

3-
See https://learn.microsoft.com/en-us/dotnet/core/runtime-config/debugging-profiling#export-perf-maps
3+
Version 7 and greater are supported. Version 8 introduced some things that make tracking functions a bit more difficult, but should largely still work.
4+
5+
Known issues:
6+
- Very large functions can fail to be symbolized. This will be fixed with: https://github.com/dotnet/runtime/pull/108939
7+
- The runtime can incorrectly track inlining and line numbers. This is an issue with exception backtraces as well. https://dotnetdocs.ir/Post/47/wrong-exception-line-number-in-stack-trace-in-release-mode

dotnet/demo.csproj

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
6-
<ImplicitUsings>enable</ImplicitUsings>
7-
<Nullable>enable</Nullable>
8-
</PropertyGroup>
9-
10-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
</PropertyGroup>
9+
10+
</Project>

dotnet/deployment.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ metadata:
44
labels:
55
app.kubernetes.io/name: demo-dotnet
66
name: dotnet
7-
namespace: parca
87
spec:
9-
replicas: 3
8+
replicas: 1
109
selector:
1110
matchLabels:
1211
app.kubernetes.io/name: demo-dotnet
@@ -16,7 +15,8 @@ spec:
1615
app.kubernetes.io/name: demo-dotnet
1716
spec:
1817
containers:
19-
- image: parca-demo:dotnet
18+
- image: quay.io/brancz/parca-demo-dotnet:latest
19+
imagePullPolicy: Always
2020
name: dotnet
2121
resources:
2222
limits:

0 commit comments

Comments
 (0)