dotnet/roslyn

CSharpObjectFormatter throws NotSupportedException if it reaches ref struct property.

Offen

#51.548 geöffnet am 28.02.2021

 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-InteractiveBugInteractive-ScriptingLogichelp wanted

Repository-Metriken

Stars
 (20.414 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

Version Used: Microsoft.CodeAnalysis.CSharp.Scripting 3.8.0 and 3.9.0-5.final (I tested both)

Steps to Reproduce:

ref struct X {};
class Y { public X x => default; };
CSharpObjectFormatter.Instance.FormatObject(new Y()); // dies

Expected Behavior:

CSharpObjectFormatter to ignore properties that are ref structs.

Actual Behavior:

CSharpObjectFormatter tries to fetch the value of the ref struct property with reflection, which throws because reflection does not support ref structs.

Contributor Guide