Enabling Developer Tools Access crashes Unity and Activity Monitor
Asked Answered
L

2

3

I'm facing the Developer Tools problem since yesterday. I use

  • Unity (several different versions, e.g. 2018.4.23),
  • Jetbrains Rider (updated today to 2020.1.3, yesterday 2020.1.2)
  • macOS Catalina 10.15.5

I was refactoring some stuff and Developer Tools asked me for the access: Developer Tools Access needs to take control of another process for debugging to continue. Enter your password to allow this...

Since then, two things are happening.

  1. If Developer Tools Access is enabled (also tried doing this through sudo /usr/sbin/DevToolsSecurity --enable command) nearly every time when I'm changing something in code, Unity stops working (loading wheel present) and I can't turn its application off. I tried using Activity Monitor, it doesn't show any activities. I can only see the loading wheel.

    I even tried killing the Unity process through kill unitypid, it "kills" the process since it's not present on the processes list, but I still can see it on my desktop, being just as down as before.

    Checking Unity logs, I can see it stops on:

    Begin MonoManager ReloadAssembly
    
    custom-attrs.c:1250: (null) 
       assembly:/Applications/Unity/Hub/Editor/2018.4.17f1/Unity.app/Contents/Managed/UnityEngine/UnityEngine.CoreModule.dll type:UnityException member:(null) signature:<none>
    
    Stacktrace:
    Native stacktrace:
        0   libmonobdwgc-2.0.dylib              0x00000001460b4976 mono_handle_native_crash + 242
    
  2. If Developer Tools Access is disabled, the application asks me a few times to enable it. After pressing Cancel a few times, Unity crashes and turns off and gives me the ability to send log error to Apple with the exception:

    Exception Type:        EXC_CRASH (SIGABRT)
    
    Exception Codes:       0x0000000000000000, 0x0000000000000000
    Exception Note:        EXC_CORPSE_NOTIFY
    
    Application Specific Information:
    abort() called
    

Don't really know what to do. I tried updating Rider, Catalina, installing a new Unity version.

Update: I formatted the disk and installed Catalina again, it still doesn't work.

Your help would be much appreciated!

Lifework answered 2/6, 2020 at 12:58 Comment(0)
L
2

After further investigation, I've discovered the following repro:

  • Create a custom attribute that derives from the PropertyAttribute that calls AssetDatabase.FindAssets("somethingsomething") in it's constructor.
  • Create a class (in my case it derives from the MonoBehaviour class in order to be able to call the constructor because of the gameObject placed on the scene) that contains a field that has a custom attribute mentioned above.
  • Add FormerlySerializedAs attribute to this field (e.g. during refactoring).
  • Create a gameObject with your class attached.

This will result in a pop-up window with a message that I've mentioned in my question:

Developer Tools Access needs to take control of another process for debugging to continue. Enter your password to allow this...

Example:

    using System.Diagnostics;
    using UnityEditor;
    using UnityEngine;

    public class CustomObjectPathAttribute : PropertyAttribute
    {    
        /// <summary>
        /// Default constructor.
        /// </summary>
        public CustomObjectPathAttribute()
        {
            var guids = AssetDatabase.FindAssets("Resources");
        }
    }

using UnityEngine.Serialization;

[System.Serializable]
public class TestClass
{
    /// <summary>
    /// Path to the file.
    /// </summary>
    [FormerlySerializedAs("pathToFile")]
    [CustomObjectPath]
    public string pathToFile2 = string.Empty;
}

using System.Collections.Generic;
using UnityEngine;

public class MyBehaviour : MonoBehaviour
{
    private List<TestClass> testClasses;

    void Start()
    {
        testClasses = new List<TestClass>();
    }
}

Attach the MyBehaviour script to the gameObject placed on the scene. The issue will occur after project recompilation.

Using AssetDatabase.FindAssets("Resources") in the custom attribute's constructor works fine if there's no FormerlySerializedAs attribute attached to the field in the TestClass.

I've reported the bug to the Unity QA Team and they successfully reproduced the issue. Here's the link to the Unity Issue Tracker: https://issuetracker.unity3d.com/issues/crash-when-using-assetdatabase-dot-findassets-in-a-custom-propertyattribute-and-when-formerlyserializedas-attribute-is-also-used

There's nothing more I can do at this point except of

  • not refactoring my fields when they have custom property attributes attached,
  • not using AssetDatabase.FindAssets in my property constructor.
Lifework answered 16/6, 2020 at 12:51 Comment(0)
Y
0

This is happening to me in 2019.3.x

It generally happens when I'm testing animations and making changes while in play mode.

Nothing short of a reboot will fix the issue.

Yurik answered 4/9, 2020 at 20:31 Comment(1)
Hi Zenas Prime, there's a unity issue tracker for this, I suppose. Unfortunately, the problem still occurs for some of the users. issuetracker.unity3d.com/issues/…Lifework

© 2022 - 2024 — McMap. All rights reserved.