Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
738ca19
Minor syntax simplficiation
WhitWaldo May 11, 2026
8e93230
Simplifying argument syntax
WhitWaldo May 11, 2026
a3e0e70
Adding new type for sourcing runtime capabilities via reflection to D…
WhitWaldo May 11, 2026
66a01c9
Updated all new packages to reflect the new DaprRuntimeCapabilities t…
WhitWaldo May 11, 2026
fe94701
Adding Dapr.Common.Generators and unit test projects to solution
WhitWaldo May 14, 2026
c612311
Added line to enable mock generation of internal types in the strongl…
WhitWaldo May 14, 2026
10d2557
Passing in DaprRuntimeCapabilities as interface so it can be mocked i…
WhitWaldo May 14, 2026
d0569f8
Added Dapr common namespace to `DaprRuntimeCapabilities` type so it's…
WhitWaldo May 14, 2026
9b5e1d8
Marking project as Dapr SDK project so it's visible to the source gen…
WhitWaldo May 14, 2026
14a29f6
Adding unit tests for the client builder extensions using the DaprRun…
WhitWaldo May 14, 2026
f405ea7
Added exception for when a Dapr feature isn't available in the runtim…
WhitWaldo May 14, 2026
bc2e7c8
Updates to the Jobs client to use the version-aware client generated …
WhitWaldo May 14, 2026
4687874
Adding integration tests to validate the compatibility for Jobs acros…
WhitWaldo May 14, 2026
2f0aa8f
Adding support for runtime capabilities to Dapr tests
WhitWaldo May 14, 2026
d2c4524
Adding support for Dapr runtime capabilities to Dapr.Client for bulk …
WhitWaldo May 14, 2026
eff4c98
Merge branch 'master' into jobs-reflection
WhitWaldo May 14, 2026
42c7fc3
Updated to use new signature
WhitWaldo May 14, 2026
375e97a
Merge remote-tracking branch 'origin/jobs-reflection' into jobs-refle…
WhitWaldo May 14, 2026
bb2ded8
Adding file that was accidentally excluded from Git commit
WhitWaldo May 14, 2026
272493b
Wrapping exception thrown by runtime so it doesn't bubble out of emitter
WhitWaldo May 14, 2026
8bcc40a
Removing obsolete skip from the analyzer so fallback methods are incl…
WhitWaldo May 14, 2026
1ec3bbb
Didn't suppress enough codes
WhitWaldo May 14, 2026
8c74494
Handling cancelled exception - might be handled differently on .NET 9…
WhitWaldo May 14, 2026
3ee1f7d
Improved unit test coverage
WhitWaldo May 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<PackageVersion Include="Grpc.Core.Testing" Version="2.46.6" />
<PackageVersion Include="Grpc.Net.Client" Version="2.76.0" />
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.76.0" />
<PackageVersion Include="Grpc.Reflection" Version="2.80.0" />
<PackageVersion Include="Grpc.Tools" Version="2.78.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.24" Condition="'$(TargetFramework)' == 'net8.0'" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="9.0.13" Condition="'$(TargetFramework)' == 'net9.0'" />
Expand Down
34 changes: 32 additions & 2 deletions all.sln
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.AI.Microsoft.Extension
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.DistributedLock.Test", "test\Dapr.DistributedLock.Test\Dapr.DistributedLock.Test.csproj", "{2B8E9CAD-F9A2-43B9-BB1C-619CF64476A0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Common.Generators", "src\Dapr.Common.Generators\Dapr.Common.Generators.csproj", "{DA1F9FE7-6041-4581-B9AD-685034869CE8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dapr.Common.Generators.Tests", "test\Dapr.Common.Generators.Tests\Dapr.Common.Generators.Tests.csproj", "{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1558,6 +1562,30 @@ Global
{2B8E9CAD-F9A2-43B9-BB1C-619CF64476A0}.Release|x64.Build.0 = Release|Any CPU
{2B8E9CAD-F9A2-43B9-BB1C-619CF64476A0}.Release|x86.ActiveCfg = Release|Any CPU
{2B8E9CAD-F9A2-43B9-BB1C-619CF64476A0}.Release|x86.Build.0 = Release|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Debug|x64.ActiveCfg = Debug|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Debug|x64.Build.0 = Debug|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Debug|x86.ActiveCfg = Debug|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Debug|x86.Build.0 = Debug|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Release|Any CPU.Build.0 = Release|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Release|x64.ActiveCfg = Release|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Release|x64.Build.0 = Release|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Release|x86.ActiveCfg = Release|Any CPU
{DA1F9FE7-6041-4581-B9AD-685034869CE8}.Release|x86.Build.0 = Release|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Debug|x64.ActiveCfg = Debug|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Debug|x64.Build.0 = Debug|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Debug|x86.ActiveCfg = Debug|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Debug|x86.Build.0 = Debug|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Release|Any CPU.Build.0 = Release|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Release|x64.ActiveCfg = Release|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Release|x64.Build.0 = Release|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Release|x86.ActiveCfg = Release|Any CPU
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1681,11 +1709,13 @@ Global
{01A20A89-53A1-4D5B-B563-89E157718474} = {8462B106-175A-423A-BA94-BE0D39D0BD8E}
{7B14879F-156B-417E-ACA3-0B5A69CC2F39} = {8462B106-175A-423A-BA94-BE0D39D0BD8E}
{A1B2C3D4-E5F6-7890-ABCD-EF1234567890} = {8462B106-175A-423A-BA94-BE0D39D0BD8E}
{8777EAD2-419B-4683-826A-82B7C1F4F69F} = {8462B106-175A-423A-BA94-BE0D39D0BD8E}
{C6948155-C70C-4C03-A733-0624402AEC97} = {8462B106-175A-423A-BA94-BE0D39D0BD8E}
{6C77A2C4-0A96-4B90-AFEA-16E86A906259} = {BF3ED6BF-ADF3-4D25-8E89-02FB8D945CA9}
{86CBB08F-601A-4B0B-87BF-383D391A961C} = {0AF0FE8D-C234-4F04-8514-32206ACE01BD}
{2B8E9CAD-F9A2-43B9-BB1C-619CF64476A0} = {0AF0FE8D-C234-4F04-8514-32206ACE01BD}
{C6948155-C70C-4C03-A733-0624402AEC97} = {8462B106-175A-423A-BA94-BE0D39D0BD8E}
{8777EAD2-419B-4683-826A-82B7C1F4F69F} = {8462B106-175A-423A-BA94-BE0D39D0BD8E}
{DA1F9FE7-6041-4581-B9AD-685034869CE8} = {27C5D71D-0721-4221-9286-B94AB07B58CF}
{E015C5ED-F93F-4DB6-BA01-BC59B7859A60} = {0AF0FE8D-C234-4F04-8514-32206ACE01BD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {65220BF2-EAE1-4CB2-AA58-EBE80768CB40}
Expand Down
3 changes: 2 additions & 1 deletion src/Dapr.AI/Conversation/DaprConversationClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public override DaprConversationClient Build()
{
var daprClientDependencies = BuildDaprClientDependencies(typeof(DaprConversationClient).Assembly);
var client = new Autogenerated.DaprClient(daprClientDependencies.channel);
return new DaprConversationGrpcClient(client, daprClientDependencies.httpClient, daprClientDependencies.daprApiToken);
IDaprRuntimeCapabilities runtimeCapabilities = new DaprRuntimeCapabilities(daprClientDependencies.channel);
return new DaprConversationGrpcClient(client, daprClientDependencies.httpClient, runtimeCapabilities, daprClientDependencies.daprApiToken);
}
}
4 changes: 4 additions & 0 deletions src/Dapr.AI/Conversation/DaprConversationGrpcClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,18 @@ namespace Dapr.AI.Conversation;
/// </summary>
/// <param name="client">The Dapr client.</param>
/// <param name="httpClient">The HTTP client used by the client for calling the Dapr runtime.</param>
/// <param name="runtimeCapabilities">Used to determine which gRPC API variants the connected Dapr runtime supports.</param>
/// <param name="daprApiToken">An optional token required to send requests to the Dapr sidecar.</param>
[Experimental("DAPR_CONVERSATION",
UrlFormat = "https://docs.dapr.io/developing-applications/building-blocks/conversation/conversation-overview/")]
internal sealed class DaprConversationGrpcClient(
Autogenerated.Dapr.DaprClient client,
HttpClient httpClient,
IDaprRuntimeCapabilities runtimeCapabilities,
string? daprApiToken = null) : DaprConversationClient(client, httpClient, daprApiToken: daprApiToken)
{
private readonly IDaprRuntimeCapabilities runtimeCapabilities = runtimeCapabilities;

/// <inheritdoc />
public override async Task<ConversationResponse> ConverseAsync(IReadOnlyList<ConversationInput> inputs,
ConversationOptions options, CancellationToken cancellationToken = default)
Expand Down
7 changes: 7 additions & 0 deletions src/Dapr.Client/Dapr.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<!-- Additional Nuget package properties. -->
<PropertyGroup>
<Description>This package contains the reference assemblies for developing services using Dapr.</Description>
<!-- Enables the DaprVersionAwareGenerator to emit IVersionAwareDaprClient and
VersionAwareDaprClient for this project's gRPC client. -->
<IsDaprSdkProject>true</IsDaprSdkProject>
</PropertyGroup>

<ItemGroup>
Expand All @@ -15,6 +18,10 @@
<ItemGroup>
<ProjectReference Include="..\Dapr.Protos\Dapr.Protos.csproj" />
<ProjectReference Include="..\Dapr.Common\Dapr.Common.csproj" />
<!-- Generator reference: outputs IVersionAwareDaprClient + VersionAwareDaprClient -->
<ProjectReference Include="..\Dapr.Common.Generators\Dapr.Common.Generators.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
</ItemGroup>

</Project>
20 changes: 15 additions & 5 deletions src/Dapr.Client/DaprClientBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Dapr.Client;
using System;
using System.Net.Http;
using System.Text.Json;
using Common;
using Grpc.Net.Client;
using Autogenerated = Autogen.Grpc.v1;

Expand Down Expand Up @@ -57,7 +58,16 @@ public DaprClientBuilder()
// property exposed for testing purposes
internal GrpcChannelOptions GrpcChannelOptions { get; private set; }
internal string DaprApiToken { get; private set; }
internal TimeSpan Timeout { get; private set; }
internal TimeSpan Timeout { get; private set; }
// Allows tests to inject a pre-configured IDaprRuntimeCapabilities instead of
// creating DaprRuntimeCapabilities, which requires a live gRPC reflection endpoint.
internal IDaprRuntimeCapabilities RuntimeCapabilitiesOverride { get; private set; }

internal DaprClientBuilder UseRuntimeCapabilities(IDaprRuntimeCapabilities capabilities)
{
this.RuntimeCapabilitiesOverride = capabilities;
return this;
}

/// <summary>
/// Overrides the HTTP endpoint used by <see cref="DaprClient" /> for communicating with the Dapr runtime.
Expand Down Expand Up @@ -174,16 +184,16 @@ public DaprClient Build()

var channel = GrpcChannel.ForAddress(this.GrpcEndpoint, this.GrpcChannelOptions);
var client = new Autogenerated.Dapr.DaprClient(channel);

IDaprRuntimeCapabilities runtimeCapabilities = this.RuntimeCapabilitiesOverride ?? new DaprRuntimeCapabilities(channel);

var apiTokenHeader = DaprClient.GetDaprApiTokenHeader(this.DaprApiToken);
var httpClient = HttpClientFactory is object ? HttpClientFactory() : new HttpClient();

if (this.Timeout > TimeSpan.Zero)
{
httpClient.Timeout = this.Timeout;
}

return new DaprClientGrpc(channel, client, httpClient, httpEndpoint, this.JsonSerializerOptions, apiTokenHeader);
return new DaprClientGrpc(channel, client, httpClient, httpEndpoint, this.JsonSerializerOptions, apiTokenHeader, runtimeCapabilities);
}
}
}
8 changes: 6 additions & 2 deletions src/Dapr.Client/DaprClientGrpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace Dapr.Client;

using Common;
using Crypto;
using System;
using System.Buffers;
Expand Down Expand Up @@ -48,6 +49,7 @@ internal class DaprClientGrpc : DaprClient
private readonly GrpcChannel channel;
private readonly Autogenerated.Dapr.DaprClient client;
private readonly KeyValuePair<string, string>? apiTokenHeader;
private readonly IVersionAwareDaprClient versionAwareClient;

// property exposed for testing purposes
internal Autogenerated.Dapr.DaprClient Client => client;
Expand All @@ -60,14 +62,16 @@ internal DaprClientGrpc(
HttpClient httpClient,
Uri httpEndpoint,
JsonSerializerOptions jsonSerializerOptions,
KeyValuePair<string, string>? apiTokenHeader)
KeyValuePair<string, string>? apiTokenHeader,
IDaprRuntimeCapabilities runtimeCapabilities)
{
this.channel = channel;
this.client = inner;
this.httpClient = httpClient;
this.httpEndpoint = httpEndpoint;
this.jsonSerializerOptions = jsonSerializerOptions;
this.apiTokenHeader = apiTokenHeader;
this.versionAwareClient = new VersionAwareDaprClient(inner, runtimeCapabilities);

this.httpClient.DefaultRequestHeaders.UserAgent.Add(UserAgent());
}
Expand Down Expand Up @@ -246,7 +250,7 @@ private async Task<BulkPublishResponse<TValue>> MakeBulkPublishRequest<TValue>(

try
{
var response = await client.BulkPublishEventAsync(envelope, options);
var response = await versionAwareClient.BulkPublishEventAsync(envelope, options);

List<BulkPublishResponseFailedEntry<TValue>> failedEntries = [];

Expand Down
Loading
Loading