Initial commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.23.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
|
||||
|
||||
# This stage is used when running from VS in fast mode (Default for Debug configuration)
|
||||
FROM mcr.microsoft.com/dotnet/runtime:10.0 AS base
|
||||
USER $APP_UID
|
||||
WORKDIR /app
|
||||
|
||||
|
||||
# This stage is used to build the service project
|
||||
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
WORKDIR /src
|
||||
COPY ["CommonIssues/CommonIssues.csproj", "CommonIssues/"]
|
||||
RUN dotnet restore "./CommonIssues/CommonIssues.csproj"
|
||||
COPY . .
|
||||
WORKDIR "/src/CommonIssues"
|
||||
RUN dotnet build "./CommonIssues.csproj" -c $BUILD_CONFIGURATION -o /app/build
|
||||
|
||||
# This stage is used to publish the service project to be copied to the final stage
|
||||
FROM build AS publish
|
||||
ARG BUILD_CONFIGURATION=Release
|
||||
RUN dotnet publish "./CommonIssues.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
|
||||
|
||||
# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration)
|
||||
FROM base AS final
|
||||
WORKDIR /app
|
||||
COPY --from=publish /app/publish .
|
||||
ENTRYPOINT ["dotnet", "CommonIssues.dll"]
|
||||
@@ -0,0 +1,37 @@
|
||||
namespace CommonIssues
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
int num1 = 10;
|
||||
int num2 = 0; // This will cause a divide by zero issue
|
||||
|
||||
// The following line should handle the potential exception properly
|
||||
Console.WriteLine("Division Result: " + Divide(num1, num2));
|
||||
|
||||
// Unused variable
|
||||
int unusedVariable = 5;
|
||||
|
||||
// A poorly named variable
|
||||
int a = 7;
|
||||
|
||||
// An if statement that should use braces
|
||||
if (num1 > num2)
|
||||
Console.WriteLine("Num1 is greater");
|
||||
|
||||
// A method without a return type
|
||||
PrintMessage("Hello, World!, World! 12345678");
|
||||
}
|
||||
|
||||
static int Divide(int x, int y)
|
||||
{
|
||||
return x / y; // Potential divide by zero exception if y is 0
|
||||
}
|
||||
|
||||
static void PrintMessage(string message) // Should return something (or be void)
|
||||
{
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"profiles": {
|
||||
"CommonIssues": {
|
||||
"commandName": "Project"
|
||||
},
|
||||
"Container (Dockerfile)": {
|
||||
"commandName": "Docker"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user