Skip to content

get attributes from objects created on runtime #90164

@ehsangfl

Description

@ehsangfl

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Runtimebject.GetType().GetProperty("prop1").GetCustomAttributes() raised an error when the runtime object was created through System.Reflection.Emit.TypeBuilder

platform: Blazor wasm
version: 7.0.8
browser: Chrome

Expected Behavior

Runtimebject.GetType().GetProperty("prop1").GetCustomAttributes() return a list of attributes contains Display and Required attribute

Steps To Reproduce

I created a type through System.Reflection.Emit.TypeBuilder and named it RutimeObject

then I added a property named prope1. then add some attributes to the prop1 (Display and Required attributes)
then I create an instance from RuntimeObject
when I try to get custom attributes through reflection
Runtimebject.GetType().GetProperty("prop1").GetCustomAttributes();

this has not happened if you add only one attribute and it happened if add 2 or more attributes

Exceptions (if any)

dotnet.7.0.7.d6ly7i5yxa.js:5  Error: [MONO] * Assertion at /__w/1/s/src/mono/mono/metadata/assembly.c:735, condition `<disabled>' not met

    at xe (dotnet.7.0.7.d6ly7i5yxa.js:5:509)
    at Object.je (dotnet.7.0.7.d6ly7i5yxa.js:5:792)
    at _mono_wasm_trace_logger (dotnet.7.0.7.d6ly7i5yxa.js:14:104923)
    at 00993286:0x9bf7
    at 00993286:0xa5a65
    at 00993286:0x1c0037
    at 00993286:0x1c00c6
    at 00993286:0x1c0109
    at 00993286:0x1c00dc
    at 00993286:0x33f41

.NET Version

8.0.100-preview.3.23178.7

Anything else?

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions