Search Issue Tracker

Fixed in 2018.3.5f1

Fixed in 2018.3.X

Votes

3

Found in

2018.3.0a4

2018.3.0b10

2019.1.0a10

Issue ID

1101440

Regression

Yes

[IL2CPP] NotSupportedException is thrown when using System.Type.GetCustomAttributes(Type, bool)

Scripting

-

Repro steps:
1. Open user attached project
2. Make sure “Development Build” is checked
3. Build and Run
4. Play
5. Check the player log

Actual: A NotSupportedException is thrown

Reproducible with: 2018.3.0a4, 2019.1.0a10
Not reproducible with: 2017.4.15f1, 2018.2.16f1, 2018.3.0a3

Fixed in: 2019.1.0a12
Backported to: 2018.3.5f1

Comments (13)

  1. AdamBebko

    Nov 26, 2020 20:38

    me too 2020.1. Being called from entities package

    NotSupportedException: System.Web.UI.WebResourceAttribute::set_CdnSupportsSecureConnection
    at System.Web.UI.WebResourceAttribute.set_CdnSupportsSecureConnection (System.Boolean value) [0x00000] in <00000000000000000000000000000000>:0
    at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) [0x00000] in <00000000000000000000000000000000>:0
    at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
    at System.Attribute.GetCustomAttributes (System.Reflection.Assembly element, System.Type attributeType, System.Boolean inherit) [0x00000] in <00000000000000000000000000000000>:0
    at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T] (System.Reflection.Assembly element) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Entities.TypeManager.InitializeAllComponentTypes () [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Entities.TypeManager.Initialize () [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Entities.EntityDiffer..cctor () [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Entities.World..ctor (System.String name, Unity.Entities.WorldFlags flags) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Entities.DefaultWorldInitialization.Initialize (System.String defaultWorldName, System.Boolean editorWorld) [0x00000] in <00000000000000000000000000000000>:0

    (Filename: currently not available on il2cpp Line: -1)

    ArgumentException: Unknown Type:`Unity.Entities.CompanionLink` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
    at Unity.Entities.TypeManager.ManagedException (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Entities.TypeManager.GetTypeIndex (System.Type type) [0x00000] in <00000000000000000000000000000000>:0
    at Unity.Entities.AttachToEntityClonerInjection.Initialize () [0x00000] in <00000000000000000000000000000000>:0
    Rethrow as TypeInitializationException: The type initializer for 'Unity.Entities.AttachToEntityClonerInjection' threw an exception.

  2. kiss-dev

    Apr 30, 2020 11:31

    I still get this error in 2018.4.22f !!!

    NotSupportedException: System.Configuration.ConfigurationCollectionAttribute::set_CollectionType
    System.Configuration.ConfigurationCollectionAttribute.set_CollectionType (System.Configuration.ConfigurationElementCollectionType value) (at <00000000000000000000000000000000>:0)
    System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly) (at <00000000000000000000000000000000>:0)
    System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) (at <00000000000000000000000000000000>:0)
    Kiss.Network.BackendConnection.InitializeEventsList () (at <00000000000000000000000000000000>:0)
    Kiss.Network.BackendConnection.Awake () (at <00000000000000000000000000000000>:0)

  3. chrisberkeley

    Apr 16, 2020 18:17

    Seeing this in 2018.4.19F1. Was this fix not backported to all the LTS versions?

  4. anzz

    Oct 24, 2019 07:50

    I still get this error in 2018.4.11f !!!

  5. HugoClip

    Sep 25, 2019 17:04

    I still get this error in 2018.4.9f

  6. NiklasBrettschneider

    Jun 26, 2019 10:19

    Issue appears to be present in 2019.1.7f1.

    Stacktrace:
    NotSupportedException: System.Configuration.ConfigurationCollectionAttribute::set_CollectionType
    at System.MonoCustomAttrs.GetCustomAttributesBase (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inheritedOnly)
    at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit)
    at System.Attribute.GetCustomAttributes (System.Reflection.MemberInfo element, System.Type type, System.Boolean inherit)
    at System.Reflection.CustomAttributeExtensions.GetCustomAttributes[T] (System.Reflection.MemberInfo element, System.Boolean inherit)

    The Workaround I found is to replace
    GetCustomAttributes<YourAttribute>(true)
    with
    IsDefined(typeof(YourAttribute), true)

    I found that solution here: https://stackoverflow.com/a/14718945

  7. OlehMekhedok

    May 03, 2019 22:15

    SYSTEM.TYPE.GETCUSTOMATTRIBUTES doesn't work in unity 2019.1.1 at webgl build

  8. NawarRajab

    Apr 11, 2019 19:13

    Still having the issue on 2018.3.12f1

  9. Elringus

    Mar 13, 2019 12:34

    The fix is not working for iOS builds, tested on 2018.3.8f1.

  10. TomasBlaho

    Feb 22, 2019 19:11

    We are on 2018.3.5f1, still having this issue :(

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.