Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Covariance generates not loadable assembly - covariant or contravariant type parameter was used illegally #111167

Open
vzabavnov opened this issue Dec 20, 2024 · 4 comments
Assignees
Labels
area-TypeSystem-coreclr untriaged New issue has not been triaged by the area owner

Comments

@vzabavnov
Copy link

The issue is in both net8.0 and net9.0

the test:

using Xunit;

namespace Tests;

public interface IInterface<TEntity, in TContext>
    where TEntity : IInterface<TEntity, TContext>
{
    public static void Method<TEntityProperty>()
        where TEntityProperty : IInterface<TEntityProperty, TContext> { }
}

public class UnitTests
{
    [Fact]
    public void TheTest() { }
}

Compiler gives no errors.
The test gives error :

ERROR Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''., reason: System.TypeLoadException: Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''. at System.Reflection.RuntimeAssembly.GetExportedTypes() at Xunit.Sdk.ReflectionAssemblyInfo.GetTypes(Boolean includePrivateTypes) in /_/src/xunit.execution/Sdk/Reflection/ReflectionAssemblyInfo.cs:line 80 at Xunit.Sdk.TestCollectionFactoryHelper.GetTestCollectionDefinitions(IAssemblyInfo assemblyInfo, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/TestCollectionFactoryHelper.cs:line 22 at Xunit.Sdk.CollectionPerClassTestCollectionFactory..ctor(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/CollectionPerClassTestCollectionFactory.cs:line 27 at Xunit.Sdk.ExtensibilityPointFactory.GetXunitTestCollectionFactory(IMessageSink diagnosticMessageSink, IAttributeInfo collectionBehaviorAttribute, ITestAssembly testAssembly) in /_/src/xunit.execution/Sdk/ExtensibilityPointFactory.cs:line 245 at Xunit.Sdk.XunitTestFrameworkDiscoverer..ctor(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkDiscoverer.cs:line 45 at Xunit.Sdk.XunitTestFramework.CreateDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFramework.cs:line 21 at Xunit.Sdk.TestFramework.GetDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/TestFramework.cs:line 71 at Xunit.Sdk.TestFrameworkProxy.GetDiscoverer(IAssemblyInfo assembly) in /_/src/xunit.execution/Sdk/Frameworks/TestFrameworkProxy.cs:line 68 at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 107 at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 63 at Xunit.Xunit2..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyTestAssemblyExists) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2.cs:line 41 at Xunit.XunitFrontController.CreateInnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 134 at Xunit.XunitFrontController.EnsureInitialized() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 153 at Xunit.XunitFrontController.get_InnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 93 at Xunit.XunitFrontController.Find(Boolean includeSourceInformation, IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 163 at TestFrameworkExtensions.Find(ITestFrameworkDiscoverer discoverer, Boolean includeSourceInformation, IMessageSinkWithTypes discoveryMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Extensions/TestFrameworkExtensions.cs:line 22 at JetBrains.ReSharper.TestRunner.Adapters.XUnit.Discoverer.ReportAll() in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\Discoverer.cs:line 57 at JetBrains.ReSharper.TestRunner.Adapters.XUnit.XUnitRunner.RunTests(TestRunRequest request, ITestDiscoverySink discoverySink, ITestExecutionSink executionSink) in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\XUnitRunner.cs:line 62 at JetBrains.ReSharper.TestRunner.Implementation.UnitTestRemoteAgent.Execute(TestRunRequest request) at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.<>c__DisplayClass4_1.<TryRegisterHandler>b__1() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.RunAndLog(Func`2 handler, IAutoRegisterInProtocol message)

--- EXCEPTION dotnet/roslyn#1/2 [RdFault]
Message = “
  Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''., reason: System.TypeLoadException: Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''.
     at System.Reflection.RuntimeAssembly.GetExportedTypes()
     at Xunit.Sdk.ReflectionAssemblyInfo.GetTypes(Boolean includePrivateTypes) in /_/src/xunit.execution/Sdk/Reflection/ReflectionAssemblyInfo.cs:line 80
     at Xunit.Sdk.TestCollectionFactoryHelper.GetTestCollectionDefinitions(IAssemblyInfo assemblyInfo, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/TestCollectionFactoryHelper.cs:line 22
     at Xunit.Sdk.CollectionPerClassTestCollectionFactory..ctor(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/CollectionPerClassTestCollectionFactory.cs:line 27
     at Xunit.Sdk.ExtensibilityPointFactory.GetXunitTestCollectionFactory(IMessageSink diagnosticMessageSink, IAttributeInfo collectionBehaviorAttribute, ITestAssembly testAssembly) in /_/src/xunit.execution/Sdk/ExtensibilityPointFactory.cs:line 245
     at Xunit.Sdk.XunitTestFrameworkDiscoverer..ctor(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkDiscoverer.cs:line 45
     at Xunit.Sdk.XunitTestFramework.CreateDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFramework.cs:line 21
     at Xunit.Sdk.TestFramework.GetDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/TestFramework.cs:line 71
     at Xunit.Sdk.TestFrameworkProxy.GetDiscoverer(IAssemblyInfo assembly) in /_/src/xunit.execution/Sdk/Frameworks/TestFrameworkProxy.cs:line 68
     at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 107
     at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 63
     at Xunit.Xunit2..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyTestAssemblyExists) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2.cs:line 41
     at Xunit.XunitFrontController.CreateInnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 134
     at Xunit.XunitFrontController.EnsureInitialized() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 153
     at Xunit.XunitFrontController.get_InnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 93
     at Xunit.XunitFrontController.Find(Boolean includeSourceInformation, IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 163
     at TestFrameworkExtensions.Find(ITestFrameworkDiscoverer discoverer, Boolean includeSourceInformation, IMessageSinkWithTypes discoveryMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Extensions/TestFrameworkExtensions.cs:line 22
     at JetBrains.ReSharper.TestRunner.Adapters.XUnit.Discoverer.ReportAll() in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\Discoverer.cs:line 57
     at JetBrains.ReSharper.TestRunner.Adapters.XUnit.XUnitRunner.RunTests(TestRunRequest request, ITestDiscoverySink discoverySink, ITestExecutionSink executionSink) in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\XUnitRunner.cs:line 62
     at JetBrains.ReSharper.TestRunner.Implementation.UnitTestRemoteAgent.Execute(TestRunRequest request)
     at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.<>c__DisplayClass4_1.<TryRegisterHandler>b__1()
     at System.Threading.Tasks.Task`1.InnerInvoke()
     at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location ---
     at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
  --- End of stack trace from previous location ---
     at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.RunAndLog(Func`2 handler, IAutoRegisterInProtocol message)
”
ReasonTypeFqn = System.TypeLoadException
ReasonText = “
  System.TypeLoadException: Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''.
     at System.Reflection.RuntimeAssembly.GetExportedTypes()
     at Xunit.Sdk.ReflectionAssemblyInfo.GetTypes(Boolean includePrivateTypes) in /_/src/xunit.execution/Sdk/Reflection/ReflectionAssemblyInfo.cs:line 80
     at Xunit.Sdk.TestCollectionFactoryHelper.GetTestCollectionDefinitions(IAssemblyInfo assemblyInfo, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/TestCollectionFactoryHelper.cs:line 22
     at Xunit.Sdk.CollectionPerClassTestCollectionFactory..ctor(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/CollectionPerClassTestCollectionFactory.cs:line 27
     at Xunit.Sdk.ExtensibilityPointFactory.GetXunitTestCollectionFactory(IMessageSink diagnosticMessageSink, IAttributeInfo collectionBehaviorAttribute, ITestAssembly testAssembly) in /_/src/xunit.execution/Sdk/ExtensibilityPointFactory.cs:line 245
     at Xunit.Sdk.XunitTestFrameworkDiscoverer..ctor(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkDiscoverer.cs:line 45
     at Xunit.Sdk.XunitTestFramework.CreateDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFramework.cs:line 21
     at Xunit.Sdk.TestFramework.GetDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/TestFramework.cs:line 71
     at Xunit.Sdk.TestFrameworkProxy.GetDiscoverer(IAssemblyInfo assembly) in /_/src/xunit.execution/Sdk/Frameworks/TestFrameworkProxy.cs:line 68
     at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 107
     at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 63
     at Xunit.Xunit2..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyTestAssemblyExists) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2.cs:line 41
     at Xunit.XunitFrontController.CreateInnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 134
     at Xunit.XunitFrontController.EnsureInitialized() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 153
     at Xunit.XunitFrontController.get_InnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 93
     at Xunit.XunitFrontController.Find(Boolean includeSourceInformation, IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 163
     at TestFrameworkExtensions.Find(ITestFrameworkDiscoverer discoverer, Boolean includeSourceInformation, IMessageSinkWithTypes discoveryMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Extensions/TestFrameworkExtensions.cs:line 22
     at JetBrains.ReSharper.TestRunner.Adapters.XUnit.Discoverer.ReportAll() in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\Discoverer.cs:line 57
     at JetBrains.ReSharper.TestRunner.Adapters.XUnit.XUnitRunner.RunTests(TestRunRequest request, ITestDiscoverySink discoverySink, ITestExecutionSink executionSink) in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\XUnitRunner.cs:line 62
     at JetBrains.ReSharper.TestRunner.Implementation.UnitTestRemoteAgent.Execute(TestRunRequest request)
     at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.<>c__DisplayClass4_1.<TryRegisterHandler>b__1()
     at System.Threading.Tasks.Task`1.InnerInvoke()
     at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location ---
     at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
  --- End of stack trace from previous location ---
     at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.RunAndLog(Func`2 handler, IAutoRegisterInProtocol message)
”
ReasonMessage = “Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''.”
StackTraceString = “
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.Activation.ServerMessageBroker.<SendMessage>d__2.MoveNext() in SendMessage.il:line IL_0077 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.TestRunnerAgentManager.TestRunnerExecutionAgent.<<RunTests>b__8_1>d.MoveNext() in RunTests.il:line IL_00AE mvid 42AD or RunTests.il:line IL_02D6 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.<ThrowIf>d__13`1.MoveNext() in ThrowIf.il:line IL_0118 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.<CancelIf>d__15.MoveNext() in CancelIf.il:line IL_0126 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.TestRunnerAgentManager.TestRunnerExecutionAgent.<RunTests>d__8.MoveNext() in RunTests.il:line IL_00AE mvid 42AD or RunTests.il:line IL_02D6 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.TestRunnerRunStrategy.<Run>d__14.MoveNext() in Run.il:line IL_01C8 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.<StartCore>d__37.MoveNext() in StartCore.il:line IL_01E7 mvid 42AD or StartCore.il:line IL_03B3 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at JetBrains.Util.Special.GeneralUtil.WithNotNull[T](T item, Action`1 F) in WithNotNull.il:line IL_001D mvid 4DEE
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.<StartCore>d__37.MoveNext() in StartCore.il:line IL_01E7 mvid 42AD or StartCore.il:line IL_03B3 mvid 42AD
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in Throw.il:line IL_000C mvid BC47
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in HandleNonSuccessAndDebuggerNotification.il:line IL_0028 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.<Start>d__36.MoveNext() in Start.il:line IL_0182 mvid 42AD
”
ExceptionPath = Root.InnerException
ClassName = JetBrains.Rd.Tasks.RdFault
HResult = COR_E_EXCEPTION=80131500
Source = mscorlib
Data.ThreadLocalDebugInfo = “
  call `ServerSocket-<noname>.JetBrains.ReSharper.TestRunner.Abstractions.IClientEndpoint.System.Threading.Tasks.Task`1[JetBrains.ReSharper.TestRunner.Abstractions.Objects.IAutoRegisterInProtocol] SendMessage(JetBrains.ReSharper.TestRunner.Abstractions.Objects.IAutoRegisterInProtocol)_proxy` (2763052212960334136), taskId=1000006
   -> call `ServerSocket-<noname>.JetBrains.ReSharper.TestRunner.Abstractions.IClientEndpoint.System.Threading.Tasks.Task`1[JetBrains.ReSharper.TestRunner.Abstractions.Objects.IAutoRegisterInProtocol] SendMessage(JetBrains.ReSharper.TestRunner.Abstractions.Objects.IAutoRegisterInProtocol)_proxy` (2763052212960334136), taskId=1000006
”

--- Outer ---

--- EXCEPTION dotnet/roslyn#2/2 [LoggerException]
Message = “
  Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''., reason: System.TypeLoadException: Could not load type 'Tests.IInterface`2' from assembly 'TheCovariantTests, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because a covariant or contravariant type parameter was used illegally in a type parameter constraint in method ''.
     at System.Reflection.RuntimeAssembly.GetExportedTypes()
     at Xunit.Sdk.ReflectionAssemblyInfo.GetTypes(Boolean includePrivateTypes) in /_/src/xunit.execution/Sdk/Reflection/ReflectionAssemblyInfo.cs:line 80
     at Xunit.Sdk.TestCollectionFactoryHelper.GetTestCollectionDefinitions(IAssemblyInfo assemblyInfo, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/TestCollectionFactoryHelper.cs:line 22
     at Xunit.Sdk.CollectionPerClassTestCollectionFactory..ctor(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink) in /_/src/xunit.execution/Sdk/Frameworks/CollectionPerClassTestCollectionFactory.cs:line 27
     at Xunit.Sdk.ExtensibilityPointFactory.GetXunitTestCollectionFactory(IMessageSink diagnosticMessageSink, IAttributeInfo collectionBehaviorAttribute, ITestAssembly testAssembly) in /_/src/xunit.execution/Sdk/ExtensibilityPointFactory.cs:line 245
     at Xunit.Sdk.XunitTestFrameworkDiscoverer..ctor(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFrameworkDiscoverer.cs:line 45
     at Xunit.Sdk.XunitTestFramework.CreateDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/XunitTestFramework.cs:line 21
     at Xunit.Sdk.TestFramework.GetDiscoverer(IAssemblyInfo assemblyInfo) in /_/src/xunit.execution/Sdk/Frameworks/TestFramework.cs:line 71
     at Xunit.Sdk.TestFrameworkProxy.GetDiscoverer(IAssemblyInfo assembly) in /_/src/xunit.execution/Sdk/Frameworks/TestFrameworkProxy.cs:line 68
     at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, IAssemblyInfo assemblyInfo, String assemblyFileName, String xunitExecutionAssemblyPath, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 107
     at Xunit.Xunit2Discoverer..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyAssembliesOnDisk) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2Discoverer.cs:line 63
     at Xunit.Xunit2..ctor(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, String assemblyFileName, String configFileName, Boolean shadowCopy, String shadowCopyFolder, IMessageSink diagnosticMessageSink, Boolean verifyTestAssemblyExists) in /_/src/xunit.runner.utility/Frameworks/v2/Xunit2.cs:line 41
     at Xunit.XunitFrontController.CreateInnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 134
     at Xunit.XunitFrontController.EnsureInitialized() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 153
     at Xunit.XunitFrontController.get_InnerController() in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 93
     at Xunit.XunitFrontController.Find(Boolean includeSourceInformation, IMessageSink messageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Frameworks/XunitFrontController.cs:line 163
     at TestFrameworkExtensions.Find(ITestFrameworkDiscoverer discoverer, Boolean includeSourceInformation, IMessageSinkWithTypes discoveryMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions) in /_/src/xunit.runner.utility/Extensions/TestFrameworkExtensions.cs:line 22
     at JetBrains.ReSharper.TestRunner.Adapters.XUnit.Discoverer.ReportAll() in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\Discoverer.cs:line 57
     at JetBrains.ReSharper.TestRunner.Adapters.XUnit.XUnitRunner.RunTests(TestRunRequest request, ITestDiscoverySink discoverySink, ITestExecutionSink executionSink) in Z:\BuildAgent\work\1b668fe37ef92293\ReSharperTestRunner\src\Adapters\TestRunner.Adapters.XUnit\XUnitRunner.cs:line 62
     at JetBrains.ReSharper.TestRunner.Implementation.UnitTestRemoteAgent.Execute(TestRunRequest request)
     at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.<>c__DisplayClass4_1.<TryRegisterHandler>b__1()
     at System.Threading.Tasks.Task`1.InnerInvoke()
     at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
  --- End of stack trace from previous location ---
     at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
     at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
  --- End of stack trace from previous location ---
     at JetBrains.ReSharper.TestRunner.Implementation.ClientEndpoint.RunAndLog(Func`2 handler, IAutoRegisterInProtocol message)
”
InnerException = “Exception dotnet/roslyn#1 at Root.InnerException”
StackTraceString = “
  at JetBrains.Util.ILoggerEx.LogException(ILogger logger, LoggingLevel level, Exception exception, ExceptionOrigin exceptionOrigin, String comment) in LogException.il:line IL_0025 mvid 4DEE
     at JetBrains.Util.ILoggerEx.Error(ILogger logger, Exception exception, ExceptionOrigin origin, String comment) in Error.il:line IL_000A mvid 4DEE
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.<Start>d__36.MoveNext() in Start.il:line IL_0182 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception) in SetException.il:line IL_0026 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.Launch.UnitTestRun.<StartCore>d__37.MoveNext() in StartCore.il:line IL_03B3 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception) in SetException.il:line IL_0026 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.TestRunnerRunStrategy.<Run>d__14.MoveNext() in Run.il:line IL_01C8 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception) in SetException.il:line IL_0026 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.TestRunnerAgentManager.TestRunnerExecutionAgent.<RunTests>d__8.MoveNext() in RunTests.il:line IL_00AE mvid 42AD or RunTests.il:line IL_02D6 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception) in SetException.il:line IL_0026 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.<CancelIf>d__15.MoveNext() in CancelIf.il:line IL_0126 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetResult(TResult result) in TrySetResult.il:line IL_0055 mvid BC47
     at System.Threading.Tasks.TaskFactory.CompleteOnInvokePromise.Invoke(Task completingTask) in Invoke.il:line IL_004A mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception) in SetException.il:line IL_0026 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Common.Extensions.TaskExtensions.<ThrowIf>d__13`1.MoveNext() in ThrowIf.il:line IL_0118 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetResult(TResult result) in TrySetResult.il:line IL_0055 mvid BC47
     at System.Threading.Tasks.TaskFactory.CompleteOnInvokePromise.Invoke(Task completingTask) in Invoke.il:line IL_004A mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception) in SetException.il:line IL_0026 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.TestRunnerAgentManager.TestRunnerExecutionAgent.<<RunTests>b__8_1>d.MoveNext() in RunTests.il:line IL_00AE mvid 42AD or RunTests.il:line IL_02D6 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.SetException(Exception exception) in SetException.il:line IL_0026 mvid BC47
     at JetBrains.ReSharper.UnitTestFramework.Execution.TestRunner.Activation.ServerMessageBroker.<SendMessage>d__2.MoveNext() in SendMessage.il:line IL_0077 mvid 42AD
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() in Run.il:line IL_0024 mvid BC47
     at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(Action action, Boolean allowInlining, Task& currentTask) in RunOrScheduleAction.il:line IL_001C mvid BC47
     at System.Threading.Tasks.Task.FinishContinuations() in FinishContinuations.il:line IL_0085 mvid BC47 or FinishContinuations.il:line IL_0099 mvid BC47
     at System.Threading.Tasks.Task.Finish(Boolean bUserDelegateExecuted) in Finish.il:line IL_0085 mvid BC47
     at System.Threading.Tasks.Task`1.TrySetException(Object exceptionObject) in TrySetException.il:line IL_002A mvid BC47
     at System.Threading.Tasks.TaskCompletionSource`1.TrySetException(Exception exception) in TrySetException.il:line IL_000E mvid BC47
     at System.Threading.Tasks.TaskCompletionSource`1.SetException(Exception exception) in SetException.il:line IL_000E mvid BC47
     at JetBrains.Collections.Viewable.SignalBase`1.Fire(T value) in Fire.il:line IL_0028 mvid 5279
     at JetBrains.Collections.Viewable.WriteOnceProperty`1.WriteOnceSignal.Fire(T value) in Fire.il:line IL_0000 mvid 5279
     at JetBrains.Collections.Viewable.WriteOnceProperty`1.SetIfEmpty(T newValue) in SetIfEmpty.il:line IL_0046 mvid 5279
     at JetBrains.Rd.Tasks.WiredRdTask`2.CallSite.<>c__DisplayClass5_0.<OnWireReceived>b__0() in CallSite.il:line IL_0000 mvid 22C3
     at JetBrains.Rd.Impl.MessageBroker.RdWireableDispatchHelper.<>c__DisplayClass12_0.<DoDispatch>b__0() in RdWireableDispatchHelper.il:line IL_008B mvid 22C3
     at JetBrains.Rd.Impl.MessageBroker.RdWireableDispatchHelper.DoDispatch(Lifetime lifetime, IScheduler scheduler, Action action) in DoDispatch.il:line IL_00C2 mvid 22C3
     at JetBrains.Rd.Tasks.WiredRdTask`2.CallSite.OnWireReceived(IProtocol proto, SerializationCtx ctx, UnsafeReader reader, IRdWireableDispatchHelper dispatchHelper) in OnWireReceived.il:line IL_015C mvid 22C3
     at JetBrains.Rd.Tasks.WiredRdTask`2.OnWireReceived(UnsafeReader reader, IRdWireableDispatchHelper dispatchHelper) in OnWireReceived.il:line IL_007B mvid 22C3
     at JetBrains.Rd.Impl.MessageBroker.DispatchImpl(Byte[] msg) in DispatchImpl.il:line IL_0112 mvid 22C3
     at JetBrains.Rd.Impl.MessageBroker.Dispatch(Byte[] msg) in Dispatch.il:line IL_003F mvid 22C3
     at JetBrains.Diagnostics.LogEx.Catch(ILog log, Action action) in Catch.il:line IL_0000 mvid 5279
     at JetBrains.Rd.Impl.SocketWire.Base.ReadMsg() in ReadMsg.il:line IL_00C8 mvid 22C3
     at JetBrains.Rd.Impl.SocketWire.Base.ReceiverProc(Socket socket) in ReceiverProc.il:line IL_006C mvid 22C3
     at JetBrains.Rd.Impl.SocketWire.Base.<>c__DisplayClass19_0.<.ctor>b__1(Socket socket) in Base.il:line IL_005C mvid 22C3
     at JetBrains.Collections.Viewable.SignalBase`1.Fire(T value) in Fire.il:line IL_0028 mvid 5279
     at JetBrains.Collections.Viewable.ViewableProperty`1.set_Value(T value)
     at JetBrains.Rd.Impl.SocketWire.Server.<>c__DisplayClass4_0.<StartServerSocket>b__1() in Server.il:line IL_002F mvid 22C3 or Server.il:line IL_00F6 mvid 22C3
     at JetBrains.Diagnostics.LogEx.Catch(ILog log, Action action) in Catch.il:line IL_0000 mvid 5279
     at JetBrains.Rd.Impl.SocketWire.Server.<>c__DisplayClass4_0.<StartServerSocket>b__0() in Server.il:line IL_002F mvid 22C3 or Server.il:line IL_00F6 mvid 22C3
     at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in RunInternal.il:line IL_0079 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) in Run.il:line IL_0009 mvid BC47 or Run.il:line IL_0034 mvid BC47
     at System.Threading.ThreadHelper.ThreadStart() in ThreadStart.il:line IL_002A mvid BC47
”
ExceptionPath = Root
ClassName = JetBrains.Util.LoggerException
HResult = COR_E_APPLICATION=80131600

2024.12.20 10:16:10.654    WARN Element <Tests.UnitTests.TheTest> was left Pending after its run completion.

By removing the "in" in type parameter TContext eliminates that error

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Dec 20, 2024
@huoyaoyuan
Copy link
Member

For non-static method, the compiler does report error about constraint:

public interface IInterface<TEntity, in TContext>
    where TEntity : IInterface<TEntity, TContext>
{
    public void Method<TEntityProperty>() // CS1961
        where TEntityProperty : IInterface<TEntityProperty, TContext>
    { }
}

However, there's no error for a static method with manual this;

    public static void Method<TEntityProperty>(IInterface<TEntity, TContext> @this)
        where TEntityProperty : IInterface<TEntityProperty, TContext>
    { 
    }

@jaredpar jaredpar removed the untriaged New issue has not been triaged by the area owner label Jan 6, 2025
@AlekseyTs
Copy link
Contributor

An error is reported for a virtual or abstract static method, but not for a non-virtual one. This is consistent with what the feature spec is saying (https://github.com/dotnet/csharplang/blob/main/proposals/csharp-11.0/static-abstracts-in-interfaces.md#variance-safety-18232):

These restrictions do not apply to occurrences of types within declarations of non-virtual, non-abstract static members.

Need to confirm whether the spec rules should be tighter or runtime check should be relaxed.

@AlekseyTs
Copy link
Contributor

@trylek, @davidwrighton Is runtime behavior justified? Is there a real variance safety issue around non-virtual static members? Given #39612, it looks like the fix might be incomplete, or a change was made with intention to affect only virtual statics, but affected all statics.

@AlekseyTs AlekseyTs transferred this issue from dotnet/roslyn Jan 7, 2025
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jan 7, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 7, 2025
@steveisok steveisok added area-TypeSystem-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jan 9, 2025
@davidwrighton
Copy link
Member

Hmm... maybe. Looking at the source around this faiulre...

// Method type constraints behave contravariantly
I think there is some sort of explicit check that these are only allowed to be contravariant? although that detail is a thing which may not really apply to non-virtual static methods. This is a separate issue from #39612.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TypeSystem-coreclr untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

7 participants