Closed noncasted closed 3 months ago
I'm not sure there's something he can do about it, you can try for now adding [Preserve] attribute to the constructors. Maybe there's a way to generate a link.xml only including constructors in use
Hi @AlonTalmi, I have a similar problem, only I am using SourceGenerator. Is it possible to mark all generated classes with [Preserve] attribute during generation? For example like this:
[Preserve]
private sealed class __GeneratedInjector : IInjector
AlonTalmi's comments may provide one answer.
Is it possible to mark all generated classes with [Preserve] attribute during generation?
Perhaps it is too much to mark all SourceGenerator target classes as Preserve at this time.
In fact, perhaps we should fix the filters that are subject to SourceGenerator first.
Perhaps it would be sufficient to only target classes that have Register<T>
or related declarations.
After that, I think it would be ideal to make that limited target Preserve. #668 .
Alternatively, there is a proposal to create a LinkXml generator, as in #620.
I recently updated my project to Unity 2023.1 and faced a problem, when VContainer works in editor but in build I receive an error message: "Type does not found injectable constructor, type" cause my ManagedStrippingLevel was set to High.
I temporarily solved this issue by passing all my asmdefs to link.xml, so they are ignored by stripping. It was done by this script, if some one is facing the same problem.