Skip to content

Commit 51e39bd

Browse files
committed
be consistent with azuremanaged targetversion
1 parent 6f1d2bc commit 51e39bd

File tree

2 files changed

+4
-23
lines changed

2 files changed

+4
-23
lines changed

src/Extensions/Azure/Azure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
4+
<TargetFrameworks>net6.0</TargetFrameworks>
55
<PackageDescription>Azure extensions for the Durable Task Framework.</PackageDescription>
66
<EnableStyleCop>true</EnableStyleCop>
77
</PropertyGroup>

src/Extensions/Azure/DurableTaskSchedulerExtensions.cs

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Azure.Core;
2+
using Grpc.Net.Client;
23
using Microsoft.DurableTask.Client;
34
using Microsoft.DurableTask.Worker;
45
using System.Diagnostics;
@@ -79,12 +80,8 @@ static GrpcChannel GetGrpcChannelForOptions(DurableTaskSchedulerOptions options)
7980
}
8081

8182
string resourceId = options.ResourceId ?? "https://durabletask.io";
82-
#if NET6_0
8383
int processId = Environment.ProcessId;
84-
#else
85-
int processId = Process.GetCurrentProcess().Id;
86-
#endif
87-
string workerId = options.WorkerId ?? $"{Environment.MachineName},{processId},{Guid.NewGuid()}";
84+
string workerId = options.WorkerId ?? $"{Environment.MachineName},{processId},{Guid.NewGuid():N}";
8885

8986
TokenCache? cache =
9087
options.Credential is not null
@@ -114,8 +111,7 @@ options.Credential is not null
114111
ChannelCredentials channelCreds = endpoint.StartsWith("https://") ?
115112
ChannelCredentials.SecureSsl :
116113
ChannelCredentials.Insecure;
117-
#if NET6_0
118-
return GrpcChannel.ForAddress(this.options.Address, new GrpcChannelOptions
114+
return GrpcChannel.ForAddress(options.EndpointAddress, new GrpcChannelOptions
119115
{
120116
// The same credential is being used for all operations.
121117
// https://learn.microsoft.com/aspnet/core/grpc/authn-and-authz#set-the-bearer-token-with-callcredentials
@@ -125,21 +121,6 @@ options.Credential is not null
125121
// only be done for local testing. We should hide this setting behind some kind of flag.
126122
UnsafeUseInsecureChannelCallCredentials = true,
127123
});
128-
#else
129-
return new GrpcChannel(
130-
endpoint,
131-
ChannelCredentials.Create(channelCreds, managedBackendCreds),
132-
new GrpcChannelOptions
133-
{
134-
// The same credential is being used for all operations.
135-
// https://learn.microsoft.com/aspnet/core/grpc/authn-and-authz#set-the-bearer-token-with-callcredentials
136-
Credentials = ChannelCredentials.Create(channelCreds, managedBackendCreds),
137-
138-
// TODO: This is not appropriate for use in production settings. Setting this to true should
139-
// only be done for local testing. We should hide this setting behind some kind of flag.
140-
UnsafeUseInsecureChannelCallCredentials = true,
141-
});
142-
#endif
143124
}
144125

145126
static Exception RequiredOptionMissing(string optionName)

0 commit comments

Comments
 (0)