dotnet / dotnet/vblang

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

Open
#297 23 comments 1 reaction 0 assignees View on GitHub
LDM Considering
Dominant language
No language data
Stars
328
Forks
71
PR merge metrics
No merged PRs in 30d

Description

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 `Latest` in ``.
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"

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.