ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D
MIT License
2.53k stars 366 forks source link

Reflection baking error with built-in Unity package #653

Open brookman opened 4 years ago

brookman commented 4 years ago

After upgrading to Unity 2019.2 there is a built-in package for the Jetbrains Rider IDE. This package produces an error in the reflection baking while building:

ArgumentException: Invalid path
System.IO.Path.GetDirectoryName (System.String path) (at <a8ed250850854b439cedc18931a314fe>:0)
Zenject.ReflectionBaking.UnityAssemblyResolver..ctor () (at Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs:34)
Zenject.ReflectionBaking.ReflectionBakingBuildObserver.TryWeaveAssembly (System.String assemblyAssetPath) (at Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs:65)
Zenject.ReflectionBaking.ReflectionBakingBuildObserver.OnAssemblyCompiled (System.String assemblyAssetPath, UnityEditor.Compilation.CompilerMessage[] messages) (at Assets/Plugins/Zenject/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs:37)
UnityEditor.Compilation.CompilationPipeline.<SubscribeToEvents>m__3 (System.String assemblyPath, UnityEditor.Compilation.CompilerMessage[] messages) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilation/CompilationPipeline.cs:179)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions)

The problem is that assemblies[i].Location returns an empty string. I am not sure if this is a problem with the package or with Zenject. But the Rider package is editor only so it should probably not be included in the reflection baking process.

Mathijs-Bakker commented 4 years ago

This Zenject repo is not been updated since last year or so. Have you tried the Extenject fork? As it's under active development and contribution.