The call is ambiguous between System.ServiceExtensions.GetRequiredService and Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtension

I have added SfGrid Control into my Winform app. The app targets .Net 9. When I add any control, it says

The call is ambiguous between the following methods or properties: 'System.ServiceExtensions.GetRequiredService<T>(System.IServiceProvider)' and 'Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<T>(System.IServiceProvider)'. 

How to resolve it?


Attachment: Screenshot_20260104_174412_10835820.png

1 Reply

SM Subashini Mahendran Syncfusion Team January 5, 2026 10:54 AM UTC

Hi Fiaz Awan,


Thank you for contacting us. This issue occurs because our Grid.Windows package has a dependency on Microsoft.WinForms.Designer.SDK starting with version 26.1.35. As a result, you may encounter ambiguous call errors since GetRequiredService is defined in both Microsoft.Extensions.DependencyInjection and Microsoft.WinForms.Designer.SDK. To fix this, fully qualify the Microsoft.Extensions.DependencyInjection extension when calling GetRequiredService, as shown below:


 // Ambiguous call after adding Syncfusion.Tools.Windows

// var greeter = provider.GetRequiredService<IGreeter>();

var greeter = Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<IGreeter>(provider); //this line will solve the error.

 


If the issue persists, please share a modified or reproducible sample, a video, or a code snippet so we can provide a faster, more accurate solution.


Regards,

Subashini M.


Attachment: AmbiguousSample_d42994f1.zip

Loader.
Up arrow icon