Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using C# 9.0 init accessors in a custom function gives an error inside Visual Studio extension #111

Open
christophdebaene opened this issue Mar 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@christophdebaene
Copy link
Contributor

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.

@NeVeSpl
Copy link
Owner

NeVeSpl commented Mar 19, 2024

We will see about that, officially only .net standard 2.0 and C# 7.3 are supported in the custom function.

@NeVeSpl NeVeSpl added the enhancement New feature or request label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants