dotnet/roslyn

CSharpObjectFormatter throws NotSupportedException if it reaches ref struct property.

Ouverte

#51 548 ouverte le 28 févr. 2021

 (0 commentaire) (0 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-InteractiveBugInteractive-ScriptingLogichelp wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

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.

Guide contributeur