"Unloading broken assembly" error at each compilation

Since b11, I get this error on each compile and/or play:

Unloading broken assembly Packages/com.unity.incrementalcompiler/Editor/Plugins/Unity.PureCSharpTests.dll, this assembly can cause crashes in the runtime

I tried deleting the package cache and starting from scratch but it keeps popping. Doesn’t happen with b10 and below.

Happens with a new blank project with the IncrementalCompiler package installed.

Unloading broken assembly Packages/com.unity.incrementalcompiler/Editor/Plugins/Unity.PureCSharpTests.dll, this assembly can cause crashes in the runtime

Which version of the incremental compiler are you using?

Latest 29. Had to unistall it since it also brakes our editor newtonsoft dll.

Same here, I get the error when trying to get assemblies for some reflection work using “System.Assembly.GetTypes();” using latest build 29 as well.

using System.Reflection;
using System.Collections.Generic;
using System;
using UnityEngine;

public static class ReflectionHelpers
{
    public static System.Type[] GetAllDerivedTypes<T>(this System.AppDomain aAppDomain)
        where T : MonoBehaviour
    {
        var result = new List<System.Type>();
        var assemblies = aAppDomain.GetAssemblies();
        foreach (var assembly in assemblies)
        {
            //Debug.Log(assembly.Location);
            /* Workaround commented out to reproduce error
            try
            {
                if (assembly.Location.Contains("PackageCache"))
                    continue;
            } catch { continue; }
            */

            var types = assembly.GetTypes();
            foreach (var type in types)
            {
                if (type.IsSubclassOf(typeof(T)) && !type.IsAbstract && type.IsClass)
                    result.Add(type);
            }
        }
        return result.ToArray();
    }
}

+1

Using 2018.3.11 and p.29, error is constantly present, but hasn’t caused any issues for me so far.

working on a fix. stay tuned.

1 Like

This is caused by a breaking change in one of Unity’s internal API.
I’ve released version 0.0.42-preview.30 which works with 2018.3.b11++, but breaks compatibility with previous 2018.3 betas.
For support for 2018.3.b10 and lower, please use 0.0.42-preview.29.

4 Likes

Works great in b12. Thanks!

Works for me. Thank you.

Dom, have one question. May I ask you what compiler command line tool in unity installed directory you use to compile NET4.x or NETSTANDARD2.0 assemblies? Like Unity.app/Contents/??? In the past we used mcs but that has change with the new 2018.3.

The fix works but the incremental compiler takes ages to compile things compared if I remove it.