GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(codegen): support custom grain-call return types by ReubenBond · Pull Request #10682 · dotnet/orleans Conversation
|
| File | Description |
|---|---|
| test/Orleans.CodeGenerator.Tests/CustomReturnTypeTests.cs | Adds codegen tests for custom return types, precedence, adapter assembly discovery, and diagnostics stability. |
| test/Orleans.Analyzers.Tests/GrainInterfaceMethodReturnTypeDiagnosticAnalyzerTest.cs | Adds analyzer test ensuring registered custom return types are accepted. |
| src/Orleans.Serialization.Abstractions/Annotations.cs | Expands InvokableBaseTypeAttribute applicability to return types and assemblies. |
| src/Orleans.CodeGenerator/ProxyGenerationContext.cs | Wires shared resolver into proxy generation context and mapping extraction. |
| src/Orleans.CodeGenerator/Orleans.CodeGenerator.csproj | Links the shared resolver into the code generator project. |
| src/Orleans.CodeGenerator/Model/ProxyInterfaceModelExtractor.cs | Uses the shared resolver to extract invokable base type mappings for the incremental model. |
| src/Orleans.CodeGenerator/InvokableGenerator.cs | Switches invokable base selection to resolver-based resolution and surfaces mapping diagnostics. |
| src/Orleans.CodeGenerator/Diagnostics/InvokableBaseTypeMappingDiagnostic.cs | Adds a generator diagnostic wrapper for invalid invokable base type mappings (ORLEANS0111). |
| src/Orleans.CodeGenerator/Diagnostics/DiagnosticRuleId.cs | Registers new diagnostic ID ORLEANS0111. |
| src/Orleans.CodeGenerator/AnalyzerReleases.Unshipped.md | Documents new ORLEANS0111 diagnostic. |
| src/Orleans.CodeGenerator.Shared/InvokableBaseTypeResolver.cs | Adds the shared resolver: discovery, precedence, construction/validation, and deterministic diagnostics. |
| src/Orleans.Analyzers/Orleans.Analyzers.csproj | Links the shared resolver into the analyzers project. |
| src/Orleans.Analyzers/GrainInterfaceMethodReturnTypeDiagnosticAnalyzer.cs | Updates analyzer to validate return types via resolver and adds ORLEANS0026 for invalid mappings. |
| src/Orleans.Analyzers/AnalyzerReleases.Unshipped.md | Documents new ORLEANS0026 diagnostic. |
| src/api/Orleans.Serialization.Abstractions/Orleans.Serialization.Abstractions.cs | Updates API surface file to reflect expanded attribute usage targets. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 209c9811-96cc-46b3-8705-e2ad263b1b98
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Previously missed (2) — in code that hasn't changed since the last review.
src/Orleans.Analyzers/GrainInterfaceMethodReturnTypeDiagnosticAnalyzer.cs:18
This issue also appears on line 87 of the same file.
public const string DiagnosticId = "ORLEANS0009";
public const string Title = "Grain interfaces methods must return a compatible type";
public const string MessageFormat = "Grain interface methods must return a registered grain-call return type";
public const string Category = "Usage";
src/Orleans.CodeGenerator.Shared/InvokableBaseTypeResolver.cs:133
var builder = ImmutableArray.CreateBuilder<Mapping>();
AddMappings(named.OriginalDefinition.GetAttributes(), MappingKind.ReturnType, builder);
return Sort(builder);
}
src/Orleans.CodeGenerator/InvokableGenerator.cs:262
if (resolverDiagnostic is not null
&& !resolverDiagnostic.Message.StartsWith("No invokable base type is registered", StringComparison.Ordinal))
{
throw new OrleansGeneratorDiagnosticAnalysisException(
InvokableBaseTypeMappingDiagnostic.CreateDiagnostic(resolverDiagnostic));
}
src/Orleans.Analyzers/GrainInterfaceMethodReturnTypeDiagnosticAnalyzer.cs:92
if (diagnostic is not null
&& !diagnostic.Message.StartsWith("No invokable base type is registered", StringComparison.Ordinal))
{
mappingDiagnostic ??= diagnostic;
}
}
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Previously missed (2) — in code that hasn't changed since the last review.
src/Orleans.CodeGenerator.Shared/InvokableBaseTypeResolver.cs:15
This issue also appears on line 67 of the same file.
internal const string InvokableBaseTypeAttributeMetadataName = "Orleans.InvokableBaseTypeAttribute";
internal const string DefaultInvokableBaseTypeAttributeMetadataName = "Orleans.DefaultInvokableBaseTypeAttribute";
internal const string ReturnValueProxyAttributeMetadataName = "Orleans.Invocation.ReturnValueProxyAttribute";
internal const string GeneratedActivatorConstructorAttributeMetadataName = "Orleans.GeneratedActivatorConstructorAttribute";
src/Orleans.Analyzers/GrainInterfaceMethodReturnTypeDiagnosticAnalyzer.cs:88
if (diagnostic is not null
&& !diagnostic.Message.StartsWith("No invokable base type is registered", StringComparison.Ordinal))
src/Orleans.CodeGenerator.Shared/InvokableBaseTypeResolver.cs:69
diagnostic = new ResolverDiagnostic(
$"No invokable base type is registered for return type '{Display(returnType)}' and proxy base '{Display(proxyBaseType)}'.",
method.Locations.FirstOrDefault());
src/Orleans.CodeGenerator/InvokableGenerator.cs:258
if (resolverDiagnostic is not null
&& !resolverDiagnostic.Message.StartsWith("No invokable base type is registered", StringComparison.Ordinal))
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 209c9811-96cc-46b3-8705-e2ad263b1b98
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Previously missed (1) — in code that hasn't changed since the last review.
src/Orleans.Analyzers/GrainInterfaceMethodReturnTypeDiagnosticAnalyzer.cs:91
diagnostic.Message.StartsWith("No invokable base type is registered" ...). Message-text matching is brittle for control flow (string changes/localization) and couples the analyzer to the resolver’s wording. Prefer a typed discriminator from the resolver (e.g., an enum/bool on ResolverDiagnostic) or a null diagnostic for the “not registered” case. if (diagnostic is not null
&& !diagnostic.Message.StartsWith("No invokable base type is registered", StringComparison.Ordinal))
{
mappingDiagnostic ??= diagnostic;
}
src/Orleans.CodeGenerator/InvokableGenerator.cs:262
resolverDiagnostic.Message.StartsWith("No invokable base type is registered" ...) to distinguish “unregistered return type” from “invalid mapping”. Using string matching for control flow is brittle (message text changes/localization will break behavior) and duplicates the message contract across components. Consider giving the resolver a typed discriminator (e.g., ResolverDiagnosticKind / IsMissingMapping) or returning diagnostic = null for the “not registered” case, then key off that instead. if (resolverDiagnostic is not null
&& !resolverDiagnostic.Message.StartsWith("No invokable base type is registered", StringComparison.Ordinal))
{
throw new OrleansGeneratorDiagnosticAnalysisException(
InvokableBaseTypeMappingDiagnostic.CreateDiagnostic(resolverDiagnostic));
}
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: b9ab4023-6e4e-446c-aa7a-d3e232612a1c
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Previously missed (1) — in code that hasn't changed since the last review.
src/Orleans.Analyzers/GrainInterfaceMethodReturnTypeDiagnosticAnalyzer.cs:93
[GenerateMethodSerializers] supports AllowMultiple=true and an interface can have multiple proxy bases (directly or via inheritance). If a return type is registered for one proxy base but missing for another, the analyzer will not report a diagnostic even though code generation for the other proxy base would fail. Track whether all proxy base types resolve and only return early when they all do. foreach (var proxyBaseType in proxyBaseTypes)
{
if (resolver.TryResolve(proxyBaseType, symbol, out _, out var diagnostic))
{
return;
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: Copilot App <[email protected]> Copilot-Session: b9ab4023-6e4e-446c-aa7a-d3e232612a1c
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Revert the prematurely committed feedback changes before reapplying them with the required session attribution. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 209c9811-96cc-46b3-8705-e2ad263b1b98
Validate exact emitted proxy contexts, alpha-rename generic constraints, semantically bind generated base initializers, and keep analyzer proxy selection aligned with generation. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 209c9811-96cc-46b3-8705-e2ad263b1b98
Co-authored-by: Copilot App <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.