Skip to content

Blazor: Generic attributes do not work in Mono #77047

@Code-Chops

Description

@Code-Chops

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

At the moment I am running a C# 10 .NET 6 Blazor Webassembly app with EnablePreviewFeatures so I can use generic attributes. Unfortunately when running the app, I get the following error:
dotnet..w98fhuowzh.js:1430 * Assertion: should not be reached at /__w/1/s/src/mono/mono/metadata/custom-attrs.c:2433

which leads to this code in the Mono repository: https://github.com/mono/mono/blob/main/mono/metadata/custom-attrs.c#L2451

Apparently generic attributes are not supported at the moment in Mono. And even won't be supported in .NET 7, here is the issue: #56887

I have the following questions:

  • Shouldn't this be implemented in Mono for .NET 7, because .NET 7 will support generic attributes?
  • I guess this is the runtime crashing. I don't know which part of the code crashes now because I don't see a stacktrace. How can I discover what part of my code causes this error?
  • My generic attributes are only used for source generation. Is there a way to exclude the attributes in the IL output? For example by putting the attribute in a different file (partial) and excluding the file somehow?

Expected Behavior

The Mono runtime can handle generic attributes.

Steps To Reproduce

I don't know how I can reproduce this problem as it happens in the Mono runtime and not on the IL-level.

Exceptions (if any)

  • Assertion: should not be reached at /__w/1/s/src/mono/mono/metadata/custom-attrs.c:2433

.NET Version

6.0.402

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions