Describe the bug
HandleHttpException() can't be compiled when used as an extension method to WebServer when using EmbedIO 3.1.4 from nuget.
The call is ambiguous between https://github.com/unosquare/embedio/blob/071b72eff84a0ffb52aaa94c526ab2d16d713be7/src/EmbedIO/WebServerExtensions-ExceptionHandliers.cs#L20 and https://github.com/unosquare/embedio/blob/071b72eff84a0ffb52aaa94c526ab2d16d713be7/src/EmbedIO/WebModuleExtensions-ExceptionHandlers.cs#L19
The issue seem similar to what is described here: https://stackoverflow.com/questions/5918854/generic-extension-method-ambiguity
To Reproduce
using EmbedIO;
namespace EmbedIO_Framework472Test
{
internal class Program
{
private static void Main(string[] args)
{
new WebServer().HandleHttpException(async (context, httpException) => await context.SendStandardHtmlAsync(httpException.StatusCode));
}
}
}
Neither of the following projects compile on my end:
EmbedIO_Framework472Test.zip
EmbedIO_Core21Test.zip
Screenshots

Setup
Additional context
I cannot for my life of me understand what is going on. I must be missing something? Neither of the two extension files have been modified for months, and a test exists at https://github.com/unosquare/embedio/blob/071b72eff84a0ffb52aaa94c526ab2d16d713be7/test/EmbedIO.Tests/ExceptionHandlingTest.cs#L67 which makes sure it compiles on your end.... And a newer issue https://github.com/unosquare/embedio/issues/408 uses the extension method, meaning it is still relevant. Am I using a too old version of VS, or is something with my compiler wrong?
I noticed this issue in VS 2017 but I think it was gone. Let me check what is going on.
Hi @ST-Emanuel
It seems that this is a problem in VS 2017 that it doesn't infer properly the correct Extension Method because of the generic constraint.
I already opened, build and run your sample projects without any problem using VS 2019.
Hi @ST-Emanuel
It seems that this is a problem in VS 2017 that it doesn't infer properly the correct Extension Method because of the generic constraint.
I already opened, build and run your sample projects without any problem using VS 2019.
Hi @k3z0 ,
Fair enough! I'll just do the roundabout way and call the static method directly (i.e. WebServerExtensions.HandleHttpException(server, OnServerHttpException);) in our projects until we update our build pipelines.
I'll mark this as closed, as (hopefully) very few people will have this issue in the future.