Jump to content

CS0518 when using "record struct"

Pending 0.1.0

marxy
marxy

Posted

internal readonly record struct NavRowLayout(string RowId, string Label, string Icon, float YMin, float YMax);

When using the above line alloy spits out this error:

[Alloy] ERROR: [build] plugins/GamePanel: Ui/Nav.cs:18:53 — CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported
[Alloy] ERROR: [build] plugins/GamePanel: Ui/Nav.cs:18:67 — CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported
[Alloy] ERROR: [build] plugins/GamePanel: Ui/Nav.cs:18:81 — CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported
[Alloy] ERROR: [build] plugins/GamePanel: Ui/Nav.cs:18:93 — CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported
[Alloy] ERROR: [build] plugins/GamePanel: Ui/Nav.cs:18:105 — CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported

If this is just not a supported feature that is okay, just wanted to report it so maybe a more clear message can be given. Below is the change I made to avoid this:
 

internal readonly struct NavRowLayout
{
    public readonly string RowId;
    public readonly string Label;
    public readonly string Icon;
    public readonly float YMin;
    public readonly float YMax;

    public NavRowLayout(string rowId, string label, string icon, float yMin, float yMax)
    {
        RowId = rowId;
        Label = label;
        Icon = icon;
        YMin = yMin;
        YMax = yMax;
    }
}

 

  • Like 1

About Us

Codefling is the largest marketplace for plugins, maps, tools, and more, making it easy for customers to discover new content and for creators to monetize their work.

Downloads
3.2m
Total downloads
Customers
12.3k
Customers served
Files Sold
174.4k
Total sales
Payments
3.8m
Processed total
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.