Skip to content

Commit

Permalink
Merge branch 'main' into feature/RetryPolicyHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
tomseida authored May 30, 2024
2 parents 3230de7 + 9cb039a commit a1e3538
Show file tree
Hide file tree
Showing 12 changed files with 833 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v1.2.4

- Microsoft.Azure.DurableTask.Core dependency increased to `2.17.1`

## v1.2.3

### Microsoft.DurableTask.Client
Expand Down
2 changes: 1 addition & 1 deletion eng/targets/Release.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</PropertyGroup>

<PropertyGroup>
<VersionPrefix>1.2.3</VersionPrefix>
<VersionPrefix>1.2.4</VersionPrefix>
<VersionSuffix></VersionSuffix>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Abstractions/Abstractions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.17.0" />
<PackageReference Include="Microsoft.Azure.DurableTask.Core" Version="2.17.1" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
Expand Down
2 changes: 1 addition & 1 deletion src/Abstractions/RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Microsoft.Azure.DurableTask.Core dependency increased to `2.17.0`
- Microsoft.Azure.DurableTask.Core dependency increased to `2.17.1`
352 changes: 352 additions & 0 deletions src/Analyzers/Activities/MatchingInputOutputTypeActivityAnalyzer.cs

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/Analyzers/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ DURABLE0007 | Orchestration | Warning | CancellationTokenOrchestrationAnalyzer
DURABLE0008 | Orchestration | Warning | OtherBindingsOrchestrationAnalyzer
DURABLE1001 | Attribute Binding | Error | OrchestrationTriggerBindingAnalyzer
DURABLE1002 | Attribute Binding | Error | DurableClientBindingAnalyzer
DURABLE1003 | Attribute Binding | Error | EntityTriggerBindingAnalyzer
DURABLE1003 | Attribute Binding | Error | EntityTriggerBindingAnalyzer
DURABLE2001 | Activity | Warning | MatchingInputOutputTypeActivityAnalyzer
DURABLE2002 | Activity | Warning | MatchingInputOutputTypeActivityAnalyzer
5 changes: 5 additions & 0 deletions src/Analyzers/AnalyzersCategories.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,9 @@ static class AnalyzersCategories
/// The category for the attribute binding related analyzers.
/// </summary>
public const string AttributeBinding = "Attribute Binding";

/// <summary>
/// The category for the activity related analyzers.
/// </summary>
public const string Activity = "Activity";
}
6 changes: 6 additions & 0 deletions src/Analyzers/KnownTypeSymbols.Durable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Microsoft.DurableTask.Analyzers;
public sealed partial class KnownTypeSymbols
{
INamedTypeSymbol? taskOrchestratorInterface;
INamedTypeSymbol? taskActivityBase;
INamedTypeSymbol? durableTaskRegistry;
INamedTypeSymbol? taskOrchestrationContext;
INamedTypeSymbol? durableTaskClient;
Expand All @@ -23,6 +24,11 @@ public sealed partial class KnownTypeSymbols
/// </summary>
public INamedTypeSymbol? TaskOrchestratorInterface => this.GetOrResolveFullyQualifiedType("Microsoft.DurableTask.ITaskOrchestrator", ref this.taskOrchestratorInterface);

/// <summary>
/// Gets a TaskActivity&lt;TInput,TOutput&gt; type symbol.
/// </summary>
public INamedTypeSymbol? TaskActivityBase => this.GetOrResolveFullyQualifiedType("Microsoft.DurableTask.TaskActivity`2", ref this.taskActivityBase);

/// <summary>
/// Gets a DurableTaskRegistry type symbol.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions src/Analyzers/KnownTypeSymbols.Functions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public sealed partial class KnownTypeSymbols
INamedTypeSymbol? functionOrchestrationAttribute;
INamedTypeSymbol? functionNameAttribute;
INamedTypeSymbol? durableClientAttribute;
INamedTypeSymbol? activityTriggerAttribute;
INamedTypeSymbol? entityTriggerAttribute;
INamedTypeSymbol? taskEntityDispatcher;

Expand All @@ -34,6 +35,11 @@ public sealed partial class KnownTypeSymbols
/// </summary>
public INamedTypeSymbol? DurableClientAttribute => this.GetOrResolveFullyQualifiedType("Microsoft.Azure.Functions.Worker.DurableClientAttribute", ref this.durableClientAttribute);

/// <summary>
/// Gets an ActivityTriggerAttribute type symbol.
/// </summary>
public INamedTypeSymbol? ActivityTriggerAttribute => this.GetOrResolveFullyQualifiedType("Microsoft.Azure.Functions.Worker.ActivityTriggerAttribute", ref this.activityTriggerAttribute);

/// <summary>
/// Gets an EntityTriggerAttribute type symbol.
/// </summary>
Expand Down
12 changes: 12 additions & 0 deletions src/Analyzers/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,16 @@
<data name="ThreadTaskOrchestrationAnalyzerTitle" xml:space="preserve">
<value>Thread and Task calls must be deterministic inside an orchestrator function</value>
</data>
<data name="InputArgumentTypeMismatchAnalyzerMessageFormat" xml:space="preserve">
<value>CallActivityAsync is passing the incorrect type '{0}' instead of '{1}' to the activity function '{2}'</value>
</data>
<data name="InputArgumentTypeMismatchAnalyzerTitle" xml:space="preserve">
<value>Activity function calls use the wrong argument type</value>
</data>
<data name="OutputArgumentTypeMismatchAnalyzerMessageFormat" xml:space="preserve">
<value>CallActivityAsync is expecting the return type '{0}' and that does not match the return type '{1}' of the activity function '{2}'</value>
</data>
<data name="OutputArgumentTypeMismatchAnalyzerTitle" xml:space="preserve">
<value>Activity function call return type doesn't match the function definition return type</value>
</data>
</root>
23 changes: 23 additions & 0 deletions src/Analyzers/RoslynExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
Expand Down Expand Up @@ -85,6 +86,28 @@ public static bool BaseTypeIsConstructedFrom(this INamedTypeSymbol symbol, IType
return methods.FirstOrDefault(m => m.OverriddenMethod != null && m.OverriddenMethod.OriginalDefinition.Equals(methodSymbol, SymbolEqualityComparer.Default));
}

/// <summary>
/// Gets the type argument of a method by its parameter name.
/// </summary>
/// <param name="method">Method symbol.</param>
/// <param name="parameterName">Type argument name.</param>
/// <returns>The type argument symbol.</returns>
public static ITypeSymbol? GetTypeArgumentByParameterName(this IMethodSymbol method, string parameterName)
{
(ITypeParameterSymbol param, int idx) = method.TypeParameters
.Where(t => t.Name == parameterName)
.Select((t, i) => (t, i))
.SingleOrDefault();

if (param != null)
{
Debug.Assert(idx >= 0, "parameter index is not negative");
return method.TypeArguments[idx];
}

return null;
}

/// <summary>
/// Gets the syntax nodes of a method symbol.
/// </summary>
Expand Down
Loading

0 comments on commit a1e3538

Please sign in to comment.