-
-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Describe the bug 🐞
This is easily reproducible:
using Avalonia.Controls;
namespace ClassLibrary1;
public class Class1
{
public void Blah<TViewModel, TView>()
where TView : Control
{
ShadUI.DialogManager dm1 = new();
dm1.Register<TView, TViewModel>();
}
}
On the call to Register(), I'm getting a compile error:
[SPLATDI001] TViewModel has more than one constructor and one hasn't been marked with DependencyInjectionConstructorAttribute
If the TView type constraint is removed, the error goes away, but that could be because the method call doesn't compile. Here is the ShadUI method I am calling:
public DialogManager Register<TView, TContext>() where TView : Control
{
this.CustomDialogs.Add(typeof (TContext), typeof (TView));
return this;
}
I'm sure the code generator shouldn't pick this up. Is it seeing a "Register<T, T2>() method and just assuming it's a Splat Register call? If so, is there a way to prevent this? This is a very common prototype in a lot of code bases.
I've put the code in a repo: https://github.com/cbordeman/Splat-CodeGen-Bug
Step to reproduce
Open the repo and wait a few seconds, or invoke a build.
Reproduction repository
https://github.com/cbordeman/Splat-CodeGen-Bug
Expected behavior
No compile error.
Screenshots 🖼️
No response
IDE
No response
Operating system
No response
Version
No response
Device
No response
ReactiveUI Version
No response
Additional information ℹ️
No response