Skip to content

Unable to consume C# 7.2 stack-only types in VB 15.5 #297

Open
@Nukepayload2

Description

@Nukepayload2

If I use stack only type in my VB code, error BC30668 will block compilation. I'm using VS2017 15.6.7.

Steps to reproduce:

  1. Create a .NET Core VB Console project.
  2. Edit the .vbproj file, add <LangVersion>Latest</LangVersion> in <PropertyGroup>.
  3. Create a .NET Standard 2.0 C# class library.
  4. Create a new C# code file, and add public ref struct StackOnlyType {} in that .cs file.
  5. Upgrade the C# project to 7.2 .
  6. In the VB console app, add reference to that C# project.
  7. Add Dim errorType As StackOnlyType to Sub Main.
  8. Build the whole solution.

Expected behavior:

The code should compile, because I'm not trying to put a stack-only variable on the heap.

Actual behavior:

Error: BC30668 "Types with embedded references are not supported in this version of your compiler"

Metadata

Metadata

Assignees

No one assigned

    Labels

    LDM ConsideringLDM has reviewed and we think this has merit

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions