-
Notifications
You must be signed in to change notification settings - Fork 10
Description
I made a specialized collection for mutable large structs. To mutate a struct member by this indexer, it returns a reference. While analyzer processing this file, it thrown an exception and stopped generation.
Here is the repro code snippet:
public struct ListStruct<T> : IEnumerable<T> where T : unmanaged
{
internal int CountInternal;
private T[] _storage;
// ...
public readonly ref T this[int index]
{
[method: MethodImpl(MethodImplOptions.AggressiveInlining)]
get => ref _storage[index];
}
// ...
And here is the stack trace:
System.Collections.Generic.KeyNotFoundException: Could not resolve a display name for ref T
at LivingDocumentation.SemanticModelExtensions.GetTypeDisplayString(SemanticModel semanticModel, ExpressionSyntax expression) in /_/src/LivingDocumentation.Analyzer/Extensions/SemanticModelExtensions.cs:line 24
at LivingDocumentation.SourceAnalyzer.VisitPropertyDeclaration(PropertyDeclarationSyntax node) in /_/src/LivingDocumentation.Analyzer/Analyzers/SourceAnalyzer.cs:line 158
at Microsoft.CodeAnalysis.CSharp.Syntax.PropertyDeclarationSyntax.Accept(CSharpSyntaxVisitor visitor)
...
Hope these information will help.