-
Notifications
You must be signed in to change notification settings - Fork 9
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
Unhandled exception thrown if property has type of ref T
#70
Comments
Hi, thanks for reporting the issue, at the moment I can't reproduce this. My test code: using System.Collections;
using System.Runtime.CompilerServices;
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
var list = new ListStruct<int>();
var value = list[0];
}
}
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];
}
public IEnumerator<T> GetEnumerator()
{
throw new NotImplementedException();
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
}
} I guess some additional code is required to trigger the issue. My sample code is dotnet 8.0, I tested with the analyzer from 6.0, 7.0 and 8.0. But none failed. |
Hi, thank you for your reply. When this exception thrown, I'm using PlantUML generator. Is this issue is PUML specific? |
Your stack trace mentions code in the analyzer, so I don't think the PlantUML generation has a role. Is it possible to share a minimal solution so it can be reproduced? |
Sure.
Repro project here: |
dotnet info output
|
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:
And here is the stack trace:
Hope these information will help.
The text was updated successfully, but these errors were encountered: