When using init accessors or primary constructors on records inside a custom (*.nt.cs) function
public class Sum
{
public int X { get; init; }
public int Y { get; init; }
}
Or
public record Sum(int X, int Y)
Gives the following error
error CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported
To fix the error you need to add the following code inside the custom function.
namespace System.Runtime.CompilerServices
{
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit { }
}
It would be great if this can be added automatically by the Visual Studio extension itself.
When using
initaccessors or primary constructors on records inside a custom (*.nt.cs) functionOr
Gives the following error
To fix the error you need to add the following code inside the custom function.
It would be great if this can be added automatically by the Visual Studio extension itself.