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

"CS7038: Failed to emit module" when using List Pattern Matching on custom type #60090

Closed
JaThePlayer opened this issue Mar 10, 2022 · 2 comments
Labels
Area-Compilers Bug Feature - List Patterns Resolution-Duplicate The described behavior is tracked in another issue

Comments

@JaThePlayer
Copy link

JaThePlayer commented Mar 10, 2022

Version Used: c#11 preview, Visual Studio 2022 17.1.1, though it also happens on SharpLab.
Steps to Reproduce:

  • Create a new class or struct, and implement the this[Index i] function, but don't add a Count or Length property.
  • Try to use List Pattern Matching on an instance of that class/struct

I've created a SharpLab example that suffers from this issue, though it also happens locally in Visual Studio.

Expected Behavior:
A helpful error message.
Actual Behavior:
The compiler issues an unhelpful error:
Error CS7038 Failed to emit module '_': Unable to determine specific cause of the failure.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 10, 2022
@RikkiGibson RikkiGibson added Bug Resolution-Duplicate The described behavior is tracked in another issue Feature - List Patterns and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 10, 2022
@RikkiGibson
Copy link
Contributor

Duplicate of #59465

@RikkiGibson RikkiGibson marked this as a duplicate of #59465 Mar 10, 2022
@RikkiGibson
Copy link
Contributor

Thank you for filing this issue. The fix for this should be available when VS 17.2 preview 2 comes out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers Bug Feature - List Patterns Resolution-Duplicate The described behavior is tracked in another issue
Projects
None yet
Development

No branches or pull requests

2 participants