Browse Source

Fixed an issue where the `record struct` type declared with a primary constructor could not be decompiled correctly. The reason was that `HandleInstanceFieldInitializers` did not support the `struct` type, but `DetectPrimaryConstructor` did not exclude it in advance.

Here's an example:
```cs
    public record struct CopilotContextId_RecordStruct(Guid id)
    {
        public Guid guid { get; } = id;

        public CopilotContextId_RecordStruct() : this(Guid.NewGuid())
        {

        }
    }
```
pull/3598/head
sonyps5201314 2 months ago
parent
commit
89c7e59176
  1. 2
      ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs

2
ICSharpCode.Decompiler/CSharp/RecordDecompiler.cs

@ -210,6 +210,8 @@ namespace ICSharpCode.Decompiler.CSharp @@ -210,6 +210,8 @@ namespace ICSharpCode.Decompiler.CSharp
{
if (!settings.UsePrimaryConstructorSyntax)
return null;
if (isStruct)
return null;
}
else
{

Loading…
Cancel
Save