Facepunch / sbox-issues

175 stars 12 forks source link

Cannot access BaseType of a class from TypeLibrary #3660

Closed Mbk10201 closed 1 year ago

Mbk10201 commented 1 year ago

Describe the bug

We cannot access to the basetype of a class, Its says: Whitelist Error: System.Private.CoreLib/System.Type.get_BaseType()

Its wasn't supposed that TypeLibrary provide a full whitelist of system.reflection ?

To Reproduce

foreach ( var type in TypeLibrary.GetTypes().Where( x => x.IsClass && !x.IsAbstract ) )
{
    if ( type.TargetType.BaseType is not null )
    {
        Log.Info( type.TargetType.BaseType.Name );
    }
}

Expected behavior

To be able to access the base type through the TargetType.BaseType

Media/Files

No response

Additional context

No response

ogterry commented 1 year ago

Same issue here! Very annoying.

Game4Freak commented 1 year ago

There was an issue ~1 year ago about this but it's still not added :( https://github.com/sboxgame/issues/issues/2611

Game4Freak commented 1 year ago

Thanks Garry :)