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

Tests failed with error message: violates the constraint of type parameter 'T'. #54941

Closed
VincentBu opened this issue Jun 30, 2021 · 11 comments · Fixed by #55308
Closed

Tests failed with error message: violates the constraint of type parameter 'T'. #54941

VincentBu opened this issue Jun 30, 2021 · 11 comments · Fixed by #55308
Assignees
Labels
area-TypeSystem-coreclr JitStress CLR JIT issues involving JIT internal stress modes
Milestone

Comments

@VincentBu
Copy link
Contributor

Run: runtime-coreclr libraries-jitstress 20210629.1

Failed tests:


- System.Text.Tests.TranscodingStreamTests.Flush_FlushesInnerStreamButNotDecodedState

System.ArgumentException : Type to mock must be an interface or an abstract or non-sealed class. ---- System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.
- System.Collections.Immutable.Tests.ImmutableSortedDictionaryTest.Remove_FirstKey_RemovesKeyValuePair

System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.
- System.Collections.ObjectModel.Tests.PublicMethodsTest.RemoveAtTest

System.Security.VerificationException : Method System.SpanHelpers.IndexOf: type argument 'System.Int64' violates the constraint of type parameter 'T'.
- System.Collections.Tests.Queue_Generic_Tests_int.IGenericSharedAPI_Add_AfterRemovingAnyValue(count: 1)

System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.
- System.Diagnostics.Tests.StackTraceTests.ToString_ShowILOffset

System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.

@VincentBu VincentBu added the JitStress CLR JIT issues involving JIT internal stress modes label Jun 30, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Jun 30, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@jeffschwMSFT jeffschwMSFT added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 30, 2021
@VincentBu
Copy link
Contributor Author

Also failed in runtime-coreclr libraries-jitstress 20210630.1

Failed tests:

net6.0-Linux-Release-arm-CoreCLR_checked-jitminopts-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440

- System.Globalization.ISOWeekTests.GetWeeksInYear
- System.Globalization.ISOWeekTests.GetWeekOfYear
- System.Globalization.ISOWeekTests.GetYear
- System.Globalization.ISOWeekTests.GetYearEnd
- System.Globalization.ISOWeekTests.GetYearStart
- System.Globalization.ISOWeekTests.ToDateTime

Error message
System.TypeInitializationException : The type initializer for 'System.Globalization.ISOWeekTests' threw an exception.
---- System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.


Stack trace
   at System.Globalization.ISOWeekTests.GetWeeksInYear() in /_/src/libraries/System.Globalization.Calendars/tests/ISOWeek/ISOWeekTests.cs:line 140
----- Inner Stack Trace -----
   at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value, Int32& location)
   at System.Collections.Generic.HashSet`1.Add(T item) in /_/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/HashSet.cs:line 455
   at System.Globalization.ISOWeekTests..cctor() in /_/src/libraries/System.Globalization.Calendars/tests/ISOWeek/ISOWeekTests.cs:line 14
net6.0-Linux-Release-arm64-CoreCLR_checked-jitminopts-(Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652

- System.Text.Encodings.Web.Tests.TextEncoderSettingsTests.GetAllowedCodePoints

Error message
System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.


Stack trace
   at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value, Int32& location)
   at System.Collections.Generic.HashSet`1.UnionWith(IEnumerable`1 other) in /_/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/HashSet.cs:line 494
   at System.Collections.Generic.HashSet`1..ctor(IEnumerable`1 collection, IEqualityComparer`1 comparer) in /_/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/HashSet.cs:line 103
   at System.Linq.Enumerable.ExceptIterator[TSource](IEnumerable`1 first, IEnumerable`1 second, IEqualityComparer`1 comparer)+MoveNext() in /_/src/libraries/System.Linq/src/System/Linq/Except.cs:line 62
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length) in /_/src/libraries/Common/src/System/Collections/Generic/EnumerableHelpers.cs:line 41
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source) in /_/src/libraries/System.Linq/src/System/Linq/Buffer.cs:line 38
   at System.Linq.OrderedEnumerable`1.ToArray() in /_/src/libraries/System.Linq/src/System/Linq/OrderedEnumerable.SpeedOpt.cs:line 14
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) in /_/src/libraries/System.Linq/src/System/Linq/ToCollection.cs:line 17
   at System.Text.Encodings.Web.Tests.TextEncoderSettingsTests.GetAllowedCodePoints() in /_/src/libraries/System.Text.Encodings.Web/tests/TextEncoderSettingsTests.cs:line 394

@VincentBu
Copy link
Contributor Author

Many tests failed with same error message:
System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.

Run : runtime-coreclr libraries-jitstress 20210701.1

Failed tests:

net6.0-windows-Release-arm64-CoreCLR_checked-jitminopts-Windows.10.Arm64v8.Open

- System.ComponentModel.Composition.Registration.Tests.*

net6.0-Linux-Release-arm-CoreCLR_checked-jitminopts-(Ubuntu.1804.Arm32.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm32v7-bfcd90a-20200121150440

- XPathTests.FunctionalTests.Location.Paths.MiscWithEncodingTests.MatchesTest1138
- System.Xml.Linq.Tests.RegressionTests.CreatingXElementsFromNewDev10Types

net6.0-Linux-Release-arm64-CoreCLR_checked-jitminopts-(Ubuntu.1804.Arm64.Open)Ubuntu.1804.Armarch.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:ubuntu-18.04-helix-arm64v8-20210531091519-97d8652

- System.Linq.Tests.*

One of error messages:

System.TypeLoadException : GenericArguments[0], 'System.Int32', on 'System.Collections.Generic.GenericEqualityComparer`1[T]' violates the constraint of type parameter 'T'.


Stack trace
   at System.Collections.Generic.HashSet`1.AddIfNotPresent(T value, Int32& location)
   at System.Collections.Generic.HashSet`1.Add(T item) in /_/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/HashSet.cs:line 455
   at System.Linq.Tests.TestExtensions.RunOnceList`1.AssertAll() in /_/src/libraries/System.Linq/tests/TestExtensions.cs:line 46
   at System.Linq.Tests.TestExtensions.RunOnceList`1.CopyTo(T[] array, Int32 arrayIndex) in /_/src/libraries/System.Linq/tests/TestExtensions.cs:line 86
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length) in /_/src/libraries/Common/src/System/Collections/Generic/EnumerableHelpers.cs:line 20
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source) in /_/src/libraries/System.Linq/src/System/Linq/Buffer.cs:line 38
   at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext() in /_/src/libraries/System.Linq/src/System/Linq/OrderedEnumerable.cs:line 24
   at System.Linq.Tests.ThenByTests.RunOnce() in /_/src/libraries/System.Linq/tests/ThenByTests.cs:line 142

@JulieLeeMSFT JulieLeeMSFT removed the untriaged New issue has not been triaged by the area owner label Jul 6, 2021
@JulieLeeMSFT JulieLeeMSFT added this to the 6.0.0 milestone Jul 6, 2021
@JulieLeeMSFT
Copy link
Member

@BruceForstall PTAL. This test is failing repeatedly.

@BruceForstall
Copy link
Member

@stephentoub Does this look to you like a libraries test issue, or a CLR issue?

@stephentoub
Copy link
Member

Just from the exception, and the various unrelated tests it manifests on, I'd guess runtime.

@vlada-shubina
Copy link
Member

Not sure if it's related or not, however dotnet/templating CI started intermittently failing after this update dotnet/templating#3387 with similar message.
The issue is intermittent and fails CI at 50% rate at the moment.
Standard_Console_Output (7).log

I'll revert the runtime update to see if it helps to fight the issue and try to upgrade to Newtonsoft.Json / NuGet to see if it helps.

@BruceForstall
Copy link
Member

@jkotas any ideas here?

@jkotas
Copy link
Member

jkotas commented Jul 7, 2021

My guess is that this is regression introduced by #54588 . This PR was merged 9 days ago and this issue was opened 8 days ago.

@davidwrighton Could you please take a look?

@jkotas jkotas added area-TypeSystem-coreclr and removed area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI labels Jul 7, 2021
@davidwrighton
Copy link
Member

Will do. Agreed that this looks related to that work.

@davidwrighton davidwrighton self-assigned this Jul 7, 2021
@BruceForstall BruceForstall removed their assignment Jul 7, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jul 8, 2021
@VincentBu
Copy link
Contributor Author

Failed again in runtime 20210707.124
Failed test:

net6.0-windows-Release-arm64-CoreCLR_release-Windows.10.Arm64.Open

- System.Linq.Expressions.Tests.Return.JustReturnValue(value: 0001-01-01T00:00:00.0000000, useInterpreter: False)

Error message

System.TypeLoadException : GenericArguments[0], 'System.DateTime', on 'System.IMinMaxValue`1[TSelf]' violates the constraint of type parameter 'TSelf'.


Stack trace
   at System.RuntimeTypeHandle.GetInterfaces(RuntimeType type)
   at System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.PopulateFields(Filter filter) in /_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs:line 844
   at System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.GetListByName(Char* pName, Int32 cNameLen, Byte* pUtf8Name, Int32 cUtf8Name, MemberListType listType, CacheType cacheType) in /_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs:line 387
   at System.RuntimeType.RuntimeTypeCache.MemberInfoCache`1.Populate(String name, MemberListType listType, CacheType cacheType) in /_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs:line 350
   at System.RuntimeType.GetField(String name, BindingFlags bindingAttr) in /_/src/coreclr/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs:line 2889
   at System.Type.GetField(String name) in /_/src/libraries/System.Private.CoreLib/src/System/Type.cs:line 194
   at System.Linq.Expressions.CachedReflectionInfo.get_DateTime_MinValue() in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Common/CachedReflectionInfo.cs:line 64
   at System.Linq.Expressions.Compiler.ILGen.EmitDefault(ILGenerator il, Type type, ILocalCache locals) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs:line 1087
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitDefaultExpression(Expression expr) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs:line 135
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Generated.cs:line 143
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLabelExpression(Expression expr, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.ControlFlow.cs:line 89
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Generated.cs:line 152
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpressionAsType(Expression node, Type type, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:line 142
   at System.Linq.Expressions.Compiler.LambdaCompiler.Emit(BlockExpression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs:line 79
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitBlockExpression(Expression expr, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs:line 21
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Generated.cs:line 134
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:line 71
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitVariableAssignment(AssignBinaryExpression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:line 715
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitAssign(AssignBinaryExpression node, CompilationFlags emitAs) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:line 759
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpressionAsVoid(Expression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:line 92
   at System.Linq.Expressions.Compiler.LambdaCompiler.Emit(BlockExpression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs:line 66
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitBlockExpression(Expression expr, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs:line 21
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Generated.cs:line 134
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpressionAsType(Expression node, Type type, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs:line 142
   at System.Linq.Expressions.Compiler.LambdaCompiler.Emit(BlockExpression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs:line 79
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitBlockExpression(Expression expr, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs:line 21
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Generated.cs:line 134
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody(CompilerScope parent, Boolean inlined, CompilationFlags flags) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Lambda.cs:line 232
   at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody() in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Lambda.cs:line 195
   at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.cs:line 187
   at System.Linq.Expressions.Expression`1.Compile() in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs:line 214
   at System.Linq.Expressions.Expression`1.Compile(Boolean preferInterpretation) in /_/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/LambdaExpression.cs:line 233
   at System.Linq.Expressions.Tests.Return.JustReturnValue(Object value, Boolean useInterpreter) in /_/src/libraries/System.Linq.Expressions/tests/Goto/Return.cs:line 22

@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 8, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-TypeSystem-coreclr JitStress CLR JIT issues involving JIT internal stress modes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants