You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the operator is using the source generator package, an unit test project that references the operator project shows this compile error:
error CS0121: The call is ambiguous between the following methods or properties: 'ControllerRegistrations.RegisterControllers(KubeOps.Abstractions.Builder.IOperatorBuilder)' and 'ControllerRegistrations.RegisterControllers(KubeOps.Abstractions.Builder.IOperatorBuilder)'
To reproduce
Create an example operator, using the KubeOps.Generator library
Create a unit test project that references the operator project
Build the solution
Expected behavior
No response
Screenshots
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered:
This has a wider impact as it is blocking moving the entity classes in a different assembly than the controller one. This means that the library is enforcing having everything in a single project making the life harder in case of a complex operator.
A potential solution would be to skip generating the OperatorBuilderExtensions, FinalizerRegistrations and ControllerRegistrations in case no IEntityController is found in the current assembly
@robertcoltheart in case your problem is only with the Test project(s), one workaround is adding the below code in (each of) your test project:
Is it not possible to use a library with your entities in one project and attach the generator there?
Maybe an idea would be to have some csproj properties to ignore or disable certain parts of the generator. Do you have any suggestions or best practices regarding source generators? It's the first I ever wrote ;-)
Describe the bug
When the operator is using the source generator package, an unit test project that references the operator project shows this compile error:
To reproduce
KubeOps.Generator
libraryExpected behavior
No response
Screenshots
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: