Skip to content

Commit

Permalink
Support for Dapr 1.12.0+ (#62)
Browse files Browse the repository at this point in the history
* #61 : Updated target frameworks, package versions, and method for adding headers

Updated the target frameworks across multiple projects to `net8.0` and updated various package versions in `dapr_sidekick_csharp.props`, `ActorSample.ActorClient.csproj`, `ActorSample.DemoActor.csproj`, `ActorSample.IDemoActor.csproj`, `AppConfigurationSample.csproj`, `ConsulSample.Receiver.csproj`, `ConsulSample.Sender.csproj`, `ControllerSample.csproj`, `ServiceInvocationSample.csproj`, `Directory.build.props`, `Man.Dapr.Sidekick.csproj`, `Man.Dapr.Sidekick.AspNetCore.Tests.csproj`, `Man.Dapr.Sidekick.Extensions.Logging.Tests.csproj`, and `Man.Dapr.Sidekick.Tests.csproj`. Also replaced the `Add` method with the `Append` method for adding headers in `HttpContextInvocationHandlerTests.cs`.

* #61 : Add Sentry compatibility with Dapr 1.12+, and SentrySample project

* #61 : Add Placement compatibility with Dapr 1.12+, and PlacementSample project
  • Loading branch information
badgeratu authored Apr 11, 2024
1 parent 8a00cc7 commit 9a8e9f4
Show file tree
Hide file tree
Showing 57 changed files with 608 additions and 79 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
dotnet-version: ['net35', 'net48', 'net50']
dotnet-version: ['net35', 'net48', 'net80']
include:
- dotnet-version: 'net35'
display-name: '.NET Framework 3.5'
Expand All @@ -43,8 +43,8 @@ jobs:
framework: 'net48'
logger: '--logger="GitHubActions;report-warnings=false" --logger="trx"'
- dotnet-version: 'net50'
display-name: '.NET 5.0'
framework: 'net5.0'
display-name: '.NET 8.0'
framework: 'net8.0'
logger: '--logger="GitHubActions;report-warnings=false" --logger="trx"'
steps:
- uses: actions/checkout@v2
Expand Down
50 changes: 46 additions & 4 deletions all.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.6.30114.105
# Visual Studio Version 17
VisualStudioVersion = 17.10.34707.107
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A985DBAA-87F6-4860-A5D3-96376165BE17}"
ProjectSection(SolutionItems) = preProject
Expand Down Expand Up @@ -80,13 +80,27 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ControllerSample", "Control
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControllerSample", "samples\AspNetCore\ControllerSample\ControllerSample\ControllerSample.csproj", "{FE082318-2993-42A3-B2DB-28EDA77F7136}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppConfigurationSample", "samples\AspNetCore\AppConfigurationSample\AppConfigurationSample\AppConfigurationSample.csproj", "{C6911A37-51F3-4E29-8E67-39B460EE7ABA}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AppConfigurationSample", "samples\AspNetCore\AppConfigurationSample\AppConfigurationSample\AppConfigurationSample.csproj", "{C6911A37-51F3-4E29-8E67-39B460EE7ABA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AppConfigurationSample", "AppConfigurationSample", "{3AD6FEBE-37E9-436E-BE86-29668A9DDB3E}"
ProjectSection(SolutionItems) = preProject
samples\AspNetCore\AppConfigurationSample\README.md = samples\AspNetCore\AppConfigurationSample\README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SentrySample", "SentrySample", "{7F6A5D8C-9780-4824-8284-CC3149683C70}"
ProjectSection(SolutionItems) = preProject
samples\AspNetCore\SentrySample\README.md = samples\AspNetCore\SentrySample\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SentrySample", "samples\AspNetCore\SentrySample\SentrySample\SentrySample.csproj", "{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PlacementSample", "PlacementSample", "{AE430C04-78BD-4CAE-86D7-EBC599774D9C}"
ProjectSection(SolutionItems) = preProject
samples\AspNetCore\PlacementSample\README.md = samples\AspNetCore\PlacementSample\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlacementSample", "samples\AspNetCore\PlacementSample\PlacementSample\PlacementSample.csproj", "{2FC86574-6A81-4E2B-A0D4-78D46528A917}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -277,6 +291,30 @@ Global
{C6911A37-51F3-4E29-8E67-39B460EE7ABA}.Release|x64.Build.0 = Release|Any CPU
{C6911A37-51F3-4E29-8E67-39B460EE7ABA}.Release|x86.ActiveCfg = Release|Any CPU
{C6911A37-51F3-4E29-8E67-39B460EE7ABA}.Release|x86.Build.0 = Release|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x64.ActiveCfg = Debug|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x64.Build.0 = Debug|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x86.ActiveCfg = Debug|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Debug|x86.Build.0 = Debug|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|Any CPU.Build.0 = Release|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x64.ActiveCfg = Release|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x64.Build.0 = Release|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x86.ActiveCfg = Release|Any CPU
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A}.Release|x86.Build.0 = Release|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x64.ActiveCfg = Debug|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x64.Build.0 = Debug|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x86.ActiveCfg = Debug|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Debug|x86.Build.0 = Debug|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|Any CPU.Build.0 = Release|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x64.ActiveCfg = Release|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x64.Build.0 = Release|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x86.ActiveCfg = Release|Any CPU
{2FC86574-6A81-4E2B-A0D4-78D46528A917}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -304,8 +342,12 @@ Global
{A3C52771-3B41-43F6-A4DD-7B3F7BAA598D} = {D625B898-1677-4DCA-B067-C7BFB07F1314}
{C5B72F44-C52D-471D-BE29-DB1C34699220} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
{FE082318-2993-42A3-B2DB-28EDA77F7136} = {C5B72F44-C52D-471D-BE29-DB1C34699220}
{3AD6FEBE-37E9-436E-BE86-29668A9DDB3E} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
{C6911A37-51F3-4E29-8E67-39B460EE7ABA} = {3AD6FEBE-37E9-436E-BE86-29668A9DDB3E}
{3AD6FEBE-37E9-436E-BE86-29668A9DDB3E} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
{7F6A5D8C-9780-4824-8284-CC3149683C70} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
{9F4DA8E9-F253-4312-A0BB-E2873A21C41A} = {7F6A5D8C-9780-4824-8284-CC3149683C70}
{AE430C04-78BD-4CAE-86D7-EBC599774D9C} = {DA3D8137-F2DD-465D-81AA-3CA5C75087D2}
{2FC86574-6A81-4E2B-A0D4-78D46528A917} = {AE430C04-78BD-4CAE-86D7-EBC599774D9C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E906E97D-7D56-4E02-A13F-1C48AEB47A88}
Expand Down
12 changes: 6 additions & 6 deletions properties/dapr_sidekick_csharp.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<Import Project="dapr_sidekick_common.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<LangVersion>8.0</LangVersion>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<WarnOnPackingNonPackableProject>false</WarnOnPackingNonPackableProject>
<!-- OpenAPI Analyzers disabled due to issue : https://github.com/dotnet/aspnetcore/issues/14723 -->
<IncludeOpenAPIAnalyzers>false</IncludeOpenAPIAnalyzers>
<MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>1.0.2</MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>
<MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>1.0.3</MicrosoftNETFrameworkReferenceAssembliesLatestPackageVersion>
</PropertyGroup>

<!-- Cls Compliant -->
Expand Down Expand Up @@ -42,23 +42,23 @@

<!-- Asset Packages -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="5.0.3">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="MinVer" Version="2.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Roslynator.Analyzers" Version="3.0.0">
<PackageReference Include="Roslynator.Analyzers" Version="4.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All">
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" PrivateAssets="All">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
</ItemGroup>

<!-- Configure properties for MinVer -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
<PackageReference Include="Dapr.Actors" Version="1.13.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Dapr.Actors" Version="1.13.0" />
<PackageReference Include="Dapr.Actors.AspNetCore" Version="1.13.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.Actors" Version="1.2.0" />
<PackageReference Include="Dapr.Actors" Version="1.13.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<LangVersion>10</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.Extensions.Configuration" Version="1.11.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
<PackageReference Include="Dapr.AspNetCore" Version="1.11.0" />
<PackageReference Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageReference Include="Dapr.Extensions.Configuration" Version="1.13.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.11" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Dapr.AspNetCore" Version="1.13.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion samples/AspNetCore/ConsulSample/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Consul Sample

This example is based on the standard ASP.NET Core 5.0 Web API WeatherForecast template and demonstrates the Service Discovery and Invocation feature of standalone Dapr using Hashicorp Consul as a service discovery provider. While this sample runs on a single machine, it would work exactly the same way if the two services were on different machines with a central Consul cluster.
This example is based on the standard ASP.NET Core Web API WeatherForecast template and demonstrates the Service Discovery and Invocation feature of standalone Dapr using Hashicorp Consul as a service discovery provider. While this sample runs on a single machine, it would work exactly the same way if the two services were on different machines with a central Consul cluster.

## Features

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ------------------------------------------------------------
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------
Expand All @@ -20,4 +20,4 @@ public class Account
/// </summary>
public decimal Balance { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Dapr.AspNetCore" Version="1.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
<PackageReference Include="Dapr.AspNetCore" Version="1.13.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ------------------------------------------------------------
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// ------------------------------------------------------------
Expand All @@ -24,4 +24,4 @@ public class Transaction
[Range(0, double.MaxValue)]
public decimal Amount { get; set; }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\src\Man.Dapr.Sidekick.AspNetCore\Man.Dapr.Sidekick.AspNetCore.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="dapr\**\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="placement\**\*.*">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
39 changes: 39 additions & 0 deletions samples/AspNetCore/PlacementSample/PlacementSample/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Man.Dapr.Sidekick;
using Serilog;

// Add Serilog for enhanced console logging.
Log.Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
.WriteTo.Console()
.CreateLogger();

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddControllers();

// Add Dapr Sidekick with Placement
builder.Services.AddDaprSidekick(builder.Configuration)
.AddPlacement();

builder.Host.UseSerilog();

var app = builder.Build();

app.MapGet("/status", (IDaprSidecarHost sidecarHost, IDaprPlacementHost placementHost) => Results.Ok(new
{
sidecar = new
{
process = sidecarHost.GetProcessInfo(), // Information about the sidecar process such as if it is running
options = sidecarHost.GetProcessOptions() // The sidecar options if running, including ports and locations
},
placement = new
{
process = placementHost.GetProcessInfo(), // Information about the sentry process such as if it is running
options = placementHost.GetProcessOptions() // The sentry options if running, including ports and locations
},
}));

// For Dapr
app.MapHealthChecks("/health");

app.Run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"profiles": {
"PlacementSample": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "status",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
Loading

0 comments on commit 9a8e9f4

Please sign in to comment.