Zenject
Zenject copied to clipboard
Reflection Baking Invalid Path ERROR
Describe the bug Reflection Baking not working.
To Reproduce
Create a new project Add zenject Create ZenjectReflectionBakingSettings Take android build Expected behavior NO ERROR
Screenshots

EDITOR
Create a new project
Add zenject
Create ZenjectReflectionBakingSettings
Tick In Enabled In Editor

Screenshots

Extenject and Unity info (please complete the following information):
- Zenject version:9.2
- Unity version:2020.1.4f1
- Project's scripting backend [IL2CPP]
Additional context Add any other context about the problem here.
Hello there,
first of all, I'm not an Extenject developer, but just another user myself.
Looking at the code, it looks like this exception occurs if there's an assembly that currently doesn't exist in the file system, or that for another reason points to an invalid location (e. g. Unity constructing special paths for in-memory files).
In my simple test (deviates slightly from your reproduction steps), I wasn't able to observe this issue. In order to eliminate differences based on the local environment, could you please provide the following information:
- what's your operating system? (Windows or Linux? paths are represented differently)
- does the path to your project contain any non-alpha-numeric characters other than the system-specific directory separator character (
\on Windows,/on others)? - Do you have any Assembly Defenition Files in your project?
- Does the behavior change if you alter the
Api Compatibility Levelto.NET 4.x(Project Settings -> Other Settings -> Configuration)?
Background for these questions: it's possible that you're observing these issues since your project or a temporary folder used by Unity uses a path that the .Net libraries interpret as invalid. This can particularly be the case if it's an issue related to the operating system and differences in its path handling.
I'll probably try to reproduce this issue later using IL2CPP myself (I don't have the right setup to do so just yet). In case I'm not able to reproduce this issue: could you please do the following steps and post your results here?
- Open
Plugins/OptionalExtras/ReflectionBaking/Unity/UnityAssemblyResolver.cs - add
UnityEngine.Debug.LogFormat("assembly at index {0}: {1} (location: {2}, null? {3})", i, assemblies[i], assemblies[i].Location, assemblies[i].Location != null);in the constructor right aboveAddSearchDirectory(Path.GetDirectoryName(assemblies[i].Location)); - reproduce the error messages
- observe the last log message right above the exception.
Windows10 19042.630 Path: C:\Kodlama\UnityProjects\TestTemplate\Assets\3rd Party\Plugins\Zenject No Same error again

Seems like it's caused by the Rider Unity Package