When using Diagnostics extension, this extension incorrectly fails with the message
System.InvalidOperationException: 'Method Initialize(Xunit.Sdk.AsyncTestSyncContext) is ambiguous, it could be matched with more than one method on type WpfSyncContextProvider.'
although the method exists only once in WpfSyncContextProvider.
To Reproduce
Run attached unit tests. The Unit test fails with a message above. See WpfSyncContextProvider . This class has only one Initialize method.
public class WpfSyncContextProvider
{
private SynchronizationContext _syncContext;
public WpfSyncContextProvider()
{
}
public void Initialize(SynchronizationContext syncContext)
{
if (!(syncContext is DispatcherSynchronizationContext))
{
throw new InvalidOperationException("Error");
}
_syncContext = syncContext;
}
}
public class WpfSyncContextProviderTests
{
[Fact]
public void WpfSyncContextProviderCanBeRegistered_WithContainer()
{
UnityContainer container = new UnityContainer();
container.AddExtension(new Diagnostic());
container.RegisterSingleton<WpfSyncContextProvider>(new InjectionMethod(nameof(WpfSyncContextProvider.Initialize), SynchronizationContext.Current));
}
}
When using Diagnostics extension, this extension incorrectly fails with the message
System.InvalidOperationException: 'Method Initialize(Xunit.Sdk.AsyncTestSyncContext) is ambiguous, it could be matched with more than one method on type WpfSyncContextProvider.'although the method exists only once in
WpfSyncContextProvider.To Reproduce
Run attached unit tests. The Unit test fails with a message above. See
WpfSyncContextProvider. This class has only one Initialize method.