dotnet/roslyn

CSharpObjectFormatter throws NotSupportedException if it reaches ref struct property.

开放

#51,548 创建于 2021年2月28日

 (0 条评论) (0 个反应) (0 位负责人)C# (4,257 个派生)batch import
Area-InteractiveBugInteractive-ScriptingLogichelp wanted

仓库指标

星标
 (20,414 个星标)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 256 个 PR)

描述

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.

贡献者指南