45 references to InvalidCastException
Crossgen2Tasks (1)
CommonFilePulledFromSdkRepo\MessageLevel.cs (1)
27=> level >= 0 ? (MessageImportance)level : throw new InvalidCastException();
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
CommonResourceInvokerTest.cs (1)
691var expected = new InvalidCastException();
Microsoft.CodeAnalysis.LanguageServer.Protocol (12)
Protocol\SumType.cs (12)
90public static explicit operator T1(SumType<T1, T2> sum) => sum.Value is T1 tVal ? tVal : throw new InvalidCastException(); 97public static explicit operator T2(SumType<T1, T2> sum) => sum.Value is T2 tVal ? tVal : throw new InvalidCastException(); 330throw new InvalidCastException(); 338public static explicit operator T1(SumType<T1, T2, T3> sum) => sum.Value is T1 tVal ? tVal : throw new InvalidCastException(); 345public static explicit operator T2(SumType<T1, T2, T3> sum) => sum.Value is T2 tVal ? tVal : throw new InvalidCastException(); 352public static explicit operator T3(SumType<T1, T2, T3> sum) => sum.Value is T3 tVal ? tVal : throw new InvalidCastException(); 652throw new InvalidCastException(); 676throw new InvalidCastException(); 684public static explicit operator T1(SumType<T1, T2, T3, T4> sum) => sum.Value is T1 tVal ? tVal : throw new InvalidCastException(); 691public static explicit operator T2(SumType<T1, T2, T3, T4> sum) => sum.Value is T2 tVal ? tVal : throw new InvalidCastException(); 698public static explicit operator T3(SumType<T1, T2, T3, T4> sum) => sum.Value is T3 tVal ? tVal : throw new InvalidCastException(); 705public static explicit operator T4(SumType<T1, T2, T3, T4> sum) => sum.Value is T4 tVal ? tVal : throw new InvalidCastException();
Microsoft.DotNet.XUnitAssert.Tests (17)
TypeAssertsTests.cs (17)
34 var ex = new InvalidCastException(); 42 var ex = new InvalidCastException(); 58 var ex = new InvalidCastException(); 103 var ex = new InvalidCastException(); 111 var ex = new InvalidCastException(); 127 var ex = new InvalidCastException(); 164 var ex = new InvalidCastException(); 180 var ex = new InvalidCastException(); 227 var ex = new InvalidCastException(); 243 var ex = new InvalidCastException(); 284 var ex = new InvalidCastException(); 292 var result = Record.Exception(() => Assert.IsNotType<InvalidCastException>(new InvalidCastException())); 316 var ex = new InvalidCastException(); 324 var result = Record.Exception(() => Assert.IsNotType(typeof(InvalidCastException), new InvalidCastException())); 348 var ex = new InvalidCastException(); 356 var ex = new InvalidCastException(); 420 var ex = new InvalidCastException();
Microsoft.Extensions.Http.Resilience.Tests (3)
Polly\HttpCircuitBreakerStrategyOptionsTests.cs (1)
22new object[] { new InvalidCastException(), false },
Polly\HttpClientResiliencePredicatesTests.cs (1)
19new object[] { new InvalidCastException(), false },
Polly\HttpRetryStrategyOptionsTests.cs (1)
24new object[] { new InvalidCastException(), null!, false },
Microsoft.VisualBasic.Core (1)
Microsoft\VisualBasic\CompilerServices\Utils.vb (1)
90Throw New Global.System.InvalidCastException()
System.Data.Odbc (1)
Common\System\Data\Common\AdapterUtil.Odbc.cs (1)
70InvalidCastException e = new InvalidCastException();
System.Linq.Expressions (2)
System\Linq\Expressions\Interpreter\TypeOperations.cs (2)
308throw new InvalidCastException(); 313throw new InvalidCastException();
System.Private.CoreLib (2)
src\coreclr\nativeaot\Runtime.Base\src\System\Runtime\ExceptionHandling.cs (1)
325ExceptionIDs.InvalidCast => new InvalidCastException(),
src\System\TypedReference.CoreCLR.cs (1)
33static void ThrowInvalidCastException() => throw new InvalidCastException();
System.Private.Windows.Core (4)
Windows\Win32\Foundation\HandleRef.cs (2)
56throw new InvalidCastException(); 67throw new InvalidCastException();
Windows\Win32\System\Variant\VARIANT.cs (2)
958=> value.vt == VT_UNKNOWN ? value.data.punkVal : throw new InvalidCastException(); 973private static T ThrowInvalidCast<T>() => throw new InvalidCastException();
System.Reflection.Metadata (1)
System\Reflection\Throw.cs (1)
17throw new InvalidCastException();