Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2019.4.X, 2020.3.X, 2021.1.X

Votes

0

Found in

2020.1.a15

2020.2.0b2

Issue ID

1321144

Regression

No

Attribute throwing exception used together with RequireComponent attribute will crash Unity

Mono

-

Repro steps:
1) Open attached project (BadAttribute.zip)
2) Unity crashes

Reproduces on:
2020.2.0b2, 2020.3.0f1
2021.1.0b6
2021.2.0a1, 2021.2.0a9

The problem is that if mono_custom_attrs_construct() is called with an attribute type that throws an exception in its constructor, then unity crashes.

Callstack:
2021-03-12T15:35:34.272Z|0x8f80|0x00007FF9BA194E18 (mono-2.0-bdwgc) (function-name not available)
2021-03-12T15:35:34.272Z|0x8f80|0x00007FF9BA1AB7EA (mono-2.0-bdwgc) mono_property_hash_remove_object
2021-03-12T15:35:34.272Z|0x8f80|0x00007FF9BA2A82B1 (mono-2.0-bdwgc) mono_custom_attrs_construct
2021-03-12T15:35:34.803Z|0x8f80|0x00007FF62C15FFF1 (Unity) [D:\repos\unity\dev13\Runtime\ScriptingBackend\Mono\ScriptingApi_Mono.cpp:900] scripting_custom_attrs_construct
2021-03-12T15:35:34.805Z|0x8f80|0x00007FF62C0DD1A8 (Unity) [D:\repos\unity\dev13\Runtime\Scripting\AttributeScanner.cpp:43] AttributeCollectionInfo::AllocAttributesArrayIfNeeded
2021-03-12T15:35:34.806Z|0x8f80|0x00007FF62C0E7508 (Unity) [D:\repos\unity\dev13\Runtime\Scripting\AttributeScanner.cpp:59] AttributeCollectionInfo::GetAttributeObjectsArrayCount
2021-03-12T15:35:34.806Z|0x8f80|0x00007FF62C0EC534 (Unity) [D:\repos\unity\dev13\Runtime\Scripting\ManagedAttributeManager.cpp:476] ManagedAttributeManager::GetRequiredComponents
2021-03-12T15:35:34.808Z|0x8f80|0x00007FF62C0B4A31 (Unity) [D:\repos\unity\dev13\Runtime\Mono\MonoBehaviour.cpp:1665] RequiredComponentsOf
2021-03-12T15:35:34.809Z|0x8f80|0x00007FF62AD59CCE (Unity) [D:\repos\unity\dev13\Runtime\Misc\GameObjectUtility.cpp:603] CollectRequiredScriptComponents
2021-03-12T15:35:34.809Z|0x8f80|0x00007FF62AD59BA6 (Unity) [D:\repos\unity\dev13\Runtime\Misc\GameObjectUtility.cpp:909] CollectRequiredComponentsWithoutAdding
2021-03-12T15:35:34.809Z|0x8f80|0x00007FF62AD591E3 (Unity) [D:\repos\unity\dev13\Runtime\Misc\GameObjectUtility.cpp:929] CollectComponentsWithoutAdding
2021-03-12T15:35:34.810Z|0x8f80|0x00007FF62AD5300A (Unity) [D:\repos\unity\dev13\Runtime\Misc\GameObjectUtility.cpp:946] AddComponent
2021-03-12T15:35:34.810Z|0x8f80|0x00007FF62AD52B6E (Unity) [D:\repos\unity\dev13\Runtime\Misc\GameObjectUtility.cpp:1006] AddComponent
2021-03-12T15:35:34.810Z|0x8f80|0x00007FF62AD54234 (Unity) [D:\repos\unity\dev13\Runtime\Misc\GameObjectUtility.cpp:1190] AddMissingComponents
2021-03-12T15:35:34.812Z|0x8f80|0x00007FF62C4809A2 (Unity) [D:\repos\unity\dev13\Runtime\Serialize\AwakeFromLoadQueue.cpp:172] AwakeFromLoadQueue::AddMissingComponents
2021-03-12T15:35:34.812Z|0x8f80|0x00007FF62C48F742 (Unity) [D:\repos\unity\dev13\Runtime\Serialize\AwakeFromLoadQueue.cpp:190] AwakeFromLoadQueue::PersistentManagerAwakeFromLoad
2021-03-12T15:35:34.814Z|0x8f80|0x00007FF62F40124F (Unity) [D:\repos\unity\dev13\Editor\Src\AssetPipeline\PrefabImporter.cpp:399] PrefabImporter::GenerateAssetData
2021-03-12T15:35:34.815Z|0x8f80|0x00007FF6317504D6 (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\ImportAsset.cpp:400] PerformImport
2021-03-12T15:35:34.815Z|0x8f80|0x00007FF63174A8EA (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\ImportAsset.cpp:884] ImportToObjects
2021-03-12T15:35:34.815Z|0x8f80|0x00007FF631748BCD (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\ImportAsset.cpp:991] ImportAsset
2021-03-12T15:35:34.817Z|0x8f80|0x00007FF63157DB72 (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\AssetImportWorker.cpp:48] AssetImportWorker::Import
2021-03-12T15:35:34.819Z|0x8f80|0x00007FF63153AC1B (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\AssetImportManager.cpp:611] AssetImportManager::ImportInProcess
2021-03-12T15:35:34.819Z|0x8f80|0x00007FF631539976 (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\AssetImportManager.cpp:436] AssetImportManager::Import
2021-03-12T15:35:34.822Z|0x8f80|0x00007FF6316C0FE2 (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\AssetDatabaseInternal.cpp:3772] ImportAndPostprocessOutOfDateAssets
2021-03-12T15:35:34.823Z|0x8f80|0x00007FF6316DAA4F (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\AssetDatabaseInternal.cpp:4625] RefreshInternalV2
2021-03-12T15:35:34.823Z|0x8f80|0x00007FF6316F612D (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\AssetDatabaseInternal.cpp:2042] StopAssetImportingV2Internal
2021-03-12T15:35:34.823Z|0x8f80|0x00007FF6316DC5B3 (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\V2\AssetDatabaseInternal.cpp:4797] RefreshV2
2021-03-12T15:35:34.825Z|0x8f80|0x00007FF6314D44C2 (Unity) [D:\repos\unity\dev13\Modules\AssetDatabase\Editor\Public\AssetDatabase.cpp:398] AssetDatabase::Refresh
2021-03-12T15:35:34.828Z|0x8f80|0x00007FF62F35F3B6 (Unity) [D:\repos\unity\dev13\Editor\Src\Application\Application.cpp:1354] Application::InitializeProject
2021-03-12T15:35:34.829Z|0x8f80|0x00007FF63083950D (Unity) [D:\repos\unity\dev13\Editor\Platform\Windows\WinEditorMain.cpp:1017] WinMain
2021-03-12T15:35:34.829Z|0x8f80|0x00007FF6352A9D82 (Unity) [d:\agent\_work\63\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:107] invoke_main
2021-03-12T15:35:34.829Z|0x8f80|0x00007FF6352A9C6E (Unity) [d:\agent\_work\63\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288] __scrt_common_main_seh
2021-03-12T15:35:34.829Z|0x8f80|0x00007FF6352A9B2E (Unity) [d:\agent\_work\63\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:331] __scrt_common_main
2021-03-12T15:35:34.830Z|0x8f80|0x00007FF6352A9E19 (Unity) [d:\agent\_work\63\s\src\vctools\crt\vcstartup\src\startup\exe_winmain.cpp:17] WinMainCRTStartup
2021-03-12T15:35:34.830Z|0x8f80|0x00007FFA6C147034 (KERNEL32) BaseThreadInitThunk
2021-03-12T15:35:34.830Z|0x8f80|0x00007FFA6DFC2651 (ntdll) RtlUserThreadStart

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.