Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 9 additions & 2 deletions Aspire.sln
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AzureContainerApps.ApiServi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.ProjectTemplates", "src\Aspire.ProjectTemplates\Aspire.ProjectTemplates.csproj", "{D07A8344-C61A-478A-92F0-E9B2DA00D647}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WaitFor.Frontend", "playground\waitfor\WaitFor.Frontend\WaitFor.Frontend.csproj", "{C88BBF0B-7566-48BD-A2BC-05374B1A2B22}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WaitFor.Frontend", "playground\waitfor\WaitFor.Frontend\WaitFor.Frontend.csproj", "{C88BBF0B-7566-48BD-A2BC-05374B1A2B22}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HealthChecks", "HealthChecks", "{B7345F72-712F-436C-AE18-CAF7CDD4A990}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HealthChecksSandbox.AppHost", "playground\HealthChecks\HealthChecksSandbox.AppHost\HealthChecksSandbox.AppHost.csproj", "{042DD8C6-A26C-4B06-80A1-FE7F8659C5BC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HealthChecksSandbox.AppHost", "playground\HealthChecks\HealthChecksSandbox.AppHost\HealthChecksSandbox.AppHost.csproj", "{042DD8C6-A26C-4B06-80A1-FE7F8659C5BC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DaprServiceC", "playground\dapr\ServiceC\DaprServiceC.csproj", "{B26653B9-439E-4850-A7F8-43C6E5121952}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -1683,6 +1685,10 @@ Global
{042DD8C6-A26C-4B06-80A1-FE7F8659C5BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{042DD8C6-A26C-4B06-80A1-FE7F8659C5BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{042DD8C6-A26C-4B06-80A1-FE7F8659C5BC}.Release|Any CPU.Build.0 = Release|Any CPU
{B26653B9-439E-4850-A7F8-43C6E5121952}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B26653B9-439E-4850-A7F8-43C6E5121952}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B26653B9-439E-4850-A7F8-43C6E5121952}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B26653B9-439E-4850-A7F8-43C6E5121952}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1991,6 +1997,7 @@ Global
{C88BBF0B-7566-48BD-A2BC-05374B1A2B22} = {3FF3F00C-95C0-46FC-B2BE-A3920C71E393}
{B7345F72-712F-436C-AE18-CAF7CDD4A990} = {D173887B-AF42-4576-B9C1-96B9E9B3D9C0}
{042DD8C6-A26C-4B06-80A1-FE7F8659C5BC} = {B7345F72-712F-436C-AE18-CAF7CDD4A990}
{B26653B9-439E-4850-A7F8-43C6E5121952} = {57A42144-739E-49A7-BADB-BB8F5F20FA17}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6DCEDFEC-988E-4CB3-B45B-191EB5086E0C}
Expand Down
7 changes: 3 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="$(MicrosoftExtensionsConfigurationBinderPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="$(MicrosoftExtensionsDependencyInjectionAbstractionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftExtensionsHostingAbstractionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="$(MicrosoftExtensionsHostingPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsHttpPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.Options" Version="$(MicrosoftExtensionsOptionsPackageVersion)" />
Expand Down Expand Up @@ -189,11 +189,10 @@
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.6.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" Version="5.5.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.ServiceBus" Version="5.22.0" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.EventHubs" Version="6.3.6"/>
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Extensions.EventHubs" Version="6.3.6" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.OpenTelemetry" Version="1.0.0-preview1" />
<PackageVersion Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.18.1" />
<PackageVersion Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />

<!-- Pinned versions for Component Governance - Remove when root dependencies are updated -->
<PackageVersion Include="Azure.Core" Version="1.44.1" />
<PackageVersion Include="Azure.Identity" Version="1.12.1" />
Expand All @@ -202,4 +201,4 @@
<PackageVersion Include="System.Formats.Asn1" Version="$(SystemFormatsAsn1PackageVersion)" />
<PackageVersion Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion)" />
</ItemGroup>
</Project>
</Project>
6 changes: 4 additions & 2 deletions playground/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Packages.Helix.props" Condition="'$(TestsRunningOutsideOfRepo)' == 'true'" />

<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Packages.props', '$(MSBuildThisFileDirectory)../'))" Condition="'$(TestsRunningOutsideOfRepo)' != 'true'" />
</Project>
<ItemGroup>
<PackageVersion Include="Dapr.Client" Version="1.14.0" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions playground/dapr/Dapr.AppHost/Dapr.AppHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

<ProjectReference Include="..\ServiceA\DaprServiceA.csproj" />
<ProjectReference Include="..\ServiceB\DaprServiceB.csproj" />
<ProjectReference Include="..\ServiceC\DaprServiceC.csproj" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions playground/dapr/Dapr.AppHost/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
.WithDaprSidecar()
.WithReference(pubSub);

// console app with no appPort (sender only)
builder.AddProject<Projects.DaprServiceC>("servicec")
.WithReference(stateStore)
.WithDaprSidecar();

#if !SKIP_DASHBOARD_REFERENCE
// This project is only added in playground projects to support development/debugging
// of the dashboard. It is not required in end developer code. Comment out this code
Expand Down
15 changes: 15 additions & 0 deletions playground/dapr/ServiceC/DaprServiceC.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Worker">

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

<ItemGroup>
<PackageReference Include="Dapr.Client" />
<PackageReference Include="Microsoft.Extensions.Hosting" />
</ItemGroup>

</Project>
41 changes: 41 additions & 0 deletions playground/dapr/ServiceC/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Dapr.Client;
using Test;

var builder = Host.CreateApplicationBuilder(args);

var dapr = new DaprClientBuilder()
.Build();

builder.Services.AddSingleton<DaprClient>(dapr);

builder.Services.AddHostedService<Worker>();

var app = builder.Build();

await app.RunAsync();

Console.WriteLine("Goodbye, World!");

namespace Test
{
public sealed class Worker(ILogger<Worker> logger, DaprClient dapr) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await dapr.WaitForSidecarAsync(stoppingToken);

while (!stoppingToken.IsCancellationRequested)
{
var state = await dapr.GetStateAsync<string?>(
"statestore", "cache", cancellationToken: stoppingToken);

logger.LogInformation("State: {0}", state ?? "<null>");

await Task.Delay(1000, stoppingToken);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,10 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
{
updatedArgs.AddRange(daprCommandLine.Arguments);
var endPoint = GetEndpointReference(sidecarOptions, resource);
if (endPoint is not null)

if (sidecarOptions?.AppPort is null && endPoint is { appEndpoint.IsAllocated: true })
{
if (endPoint.Value.appEndpoint.IsAllocated && sidecarOptions?.AppPort is null)
{
updatedArgs.AddRange(daprAppPortArg(endPoint.Value.appEndpoint.Port)());
}
updatedArgs.AddRange(daprAppPortArg(endPoint.Value.appEndpoint.Port)());
}

var grpc = daprCli.GetEndpoint("grpc");
Expand All @@ -213,11 +211,11 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
updatedArgs.AddRange(daprProfilePortArg(profiling.Property(EndpointProperty.TargetPort))());
}

if (sidecarOptions?.AppChannelAddress is null && endPoint is not null)
if (sidecarOptions?.AppChannelAddress is null && endPoint is { appEndpoint.IsAllocated: true })
{
updatedArgs.AddRange(daprAppChannelAddressArg(endPoint.Value.appEndpoint.Host)());
}
if (sidecarOptions?.AppProtocol is null && endPoint is not null)
if (sidecarOptions?.AppProtocol is null && endPoint is { appEndpoint.IsAllocated: true })
{
updatedArgs.AddRange(daprAppProtocol(endPoint.Value.protocol)());
}
Expand Down