I’m using 2023.1.0b15 and have a long running project which has been upgraded through I think 2021 LTS to where we are now. Trying to install the Cloud Diagnostics throws the following three errors in the console:
Assembly ‘Library/ScriptAssemblies/Unity.Services.CloudDiagnostics.Editor.dll’ will not be loaded due to errors:
Reference has errors ‘Unity.Services.Core.Editor’.
Assembly ‘Library/ScriptAssemblies/Unity.Services.Core.Configuration.Editor.dll’ will not be loaded due to errors:
Unable to resolve reference ‘System.Security.Permissions’. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Assembly ‘Library/ScriptAssemblies/Unity.Services.Core.Editor.dll’ will not be loaded due to errors:
Reference has errors ‘Unity.Services.Core.Configuration.Editor’.
I have verified that there is no issue installing Cloud Diagnostics on a fresh project on the same version of Unity. Any pointers on what might be causing the issue on this project? Many thanks!
I seem to have pinned this down to the “Editor Assemblies Compatibility Level” project configuration being set to “.NET Standard” in the project. Is this a bug, or are projects in this configuration incompatible with Cloud Diagnostics?
3 Likes
Oh boy, that was a savior! I had to import CCD (Cloud Content Delivery) into a project with lots of packages and got these obscure error messages. Apparently CCD requires .NET Framework, not Standard
1 Like
I have the same problem with multiple Unity.Services in Unity 2023.2.3f1. Changing the editor assemblies compatibility level from .NET Standard to .NET Framework and back to .NET Standard fixed the errors for this session. But when i reopen the the project again, the errors suddenly appear again. I also tried to delete the library and let them regenerate, that also did not work. Like @Luchianno mentioned, the EditorAssemblies of several Unity.Services apparently require .NET Framework.
1 Like
I’m seeing the same behavior as @Luchianno : toggling “Editor Assemblies Compatibility Level” back to “.NET Framework” removes the errors, toggling back to “.NET Standard” sometimes keeps the errors away but not upon reimporting all. It looks like the culprit is Unity.Services.Core.Configuration.Editor.dll
, based on this error:
Assembly ‘Library/ScriptAssemblies/Unity.Services.Core.Configuration.Editor.dll’ will not be loaded due to errors:
Unable to resolve reference ‘System.Security.Permissions’. Is the assembly missing or incompatible with the current platform? Reference validation can be disabled in the Plugin Inspector.
All other assemblies just say that something they reference has errors.
1 Like
From doing a little decompiling, it looks like Unity.Services.Core.Configuration.Editor
requires .NET Framework because its internal ProjectConfigurationBuildInjectorWithPlayerProcessor
class is using FileIOPermission
to detect security issues when accessing the Library/ folder. However, as that type’s docs themselves say:
Code Access Security (CAS) has been deprecated across all versions of .NET Framework and .NET. Recent versions of .NET do not honor CAS annotations and produce errors if CAS-related APIs are used. Developers should seek alternative means of accomplishing security tasks.
It looks like these types have been moved into a separate NuGet package that the Unity Services team could theoretically reference. I tried pulling in that assembly myself using UnityNuGet, but unfortunately that just leads to duplicate type definition errors, even after switching “Editor Assemblies Compatibility Level” back to “.NET Standard”. Even if that assembly could be used, its docs still say “Code Access Security is not supported or honored by the runtime”. So, ultimately, I think the Unity Services team will just need to figure out a different way to check for file security errors (I don’t really know much about CAS myself) that uses only .NET Standard APIs.