Skip to content

Analyzer for reused serializer alias #9443

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
cbgrasshopper opened this issue Apr 12, 2025 · 0 comments · May be fixed by #9447
Open

Analyzer for reused serializer alias #9443

cbgrasshopper opened this issue Apr 12, 2025 · 0 comments · May be fixed by #9447

Comments

@cbgrasshopper
Copy link

cbgrasshopper commented Apr 12, 2025

If a developer mistakenly reuses an Orleans serializer alias, Orleans produces a runtime error like this (type and alias names are represented with <PLACEHOLDER>s):

Unhandled exception. System.ArgumentException: An item with the same key has already been added. Key: <REUSED_ALIAS>
[04/11/2025 07:50:04 > 01f451: ERR ]    at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
[04/11/2025 07:50:04 > 01f451: ERR ]    at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
[04/11/2025 07:50:04 > 01f451: ERR ]    at OrleansCodeGen.<TYPE_NAME>.Metadata_<TYPE_NAME>.ConfigureInner(TypeManifestOptions config) in <BUILD_OUTPUT_PATH>\Orleans.CodeGenerator\Orleans.CodeGenerator.OrleansSerializationSourceGenerator\<TYPE_NAME>.orleans.g.cs:line 32828
[04/11/2025 07:50:04 > 01f451: ERR ]    at Orleans.Serialization.Configuration.TypeManifestProviderBase.Microsoft.Extensions.Options.IConfigureOptions<Orleans.Serialization.Configuration.TypeManifestOptions>.Configure(TypeManifestOptions options) in /_/src/Orleans.Serialization/Configuration/ITypeManifestProvider.cs:line 22

Suggestion: Add an analyzer to produce an error at build time if a serializer alias is reused rather than only at runtime

@ledjon-behluli ledjon-behluli linked a pull request Apr 16, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant