modesttree / Zenject

Dependency Injection Framework for Unity3D
MIT License
2.47k stars 272 forks source link

Disabling Reflection Baking does not stop UWP warnings #208

Open NoTuxNoBux opened 3 years ago

NoTuxNoBux commented 3 years ago

Describe the bug Reflection baking shows warnings about it not being supported are displayed on UWP, even when it is disabled entirely.

To Reproduce

  1. Switch the build settings to target UWP.
  2. Ensure reflection baking is disabled in the settings, through Assets -> Create -> Zenject -> Reflection Baking Settings and uncheck "Is Enabled In Builds" and "Is Enabled In Editor".
  3. Observe warnings on every script recompilation, despite is being disabled:
Zenject reflection baking skipped because it is not currently supported on WSA platform!
UnityEngine.Debug:LogWarning(Object)
ModestTree.Log:Warn(String, Object[]) (at Library/PackageCache/com.svermeulen.extenject@c2e33500a8/Source/Internal/Log.cs:38)
Zenject.ReflectionBaking.ReflectionBakingBuildObserver:OnAssemblyCompiled(String, CompilerMessage[]) (at Library/PackageCache/com.svermeulen.extenject@c2e33500a8/OptionalExtras/ReflectionBaking/Unity/ReflectionBakingBuildObserver.cs:33)
UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)

Expected behavior No warnings are shown, as reflection baking is disabled.

They should only be displayed if it is enabled and baking cannot be performed because the target platform does not support it.

Extenject and Unity info (please complete the following information):

Additional context ReflectionBakingBuildObserver seems to read ZenjectReflectionBakingSettings but does not read IsEnabledInEditor or IsEnabledInBuilds. Instead, it just always displays a warning on UWP, no matter whether it's enabled or not.

Alternatively, being able to uninstall the optional reflection baking extension would also solve this, but this requires #24 and an optional package per optional extra.

FreakTheMighty commented 2 years ago

I realize this is off topic, but I can’t find any explanation for why baking isn’t supported on WSA. Is there any record of why this can’t be done or what work would need to be done to add baking?

Holo-Krzysztof commented 2 years ago

I'd also like to know why this isn't supported. Is it any different than other IL2CPP-only build targets? Is it due to winmd support being special or something else entirely?

FreakTheMighty commented 2 years ago

@Holo-Krzysztof I recently just commented out the warning/exit from the baking function and managed to build and run with baking on. I haven't done much more investigation, but it wasn't obviously broken. 🤷