182 instantiations of InvalidCastException
Aspire.Confluent.Kafka (1)
src\Vendoring\OpenTelemetry.Instrumentation.ConfluentKafka\Shared\Guard.cs (1)
179throw new InvalidCastException($"Cannot cast '{paramName}' from '{value?.GetType().ToString() ?? "null"}' to '{typeof(T)}'");
Aspire.Microsoft.Data.SqlClient (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\Guard.cs (1)
177throw new InvalidCastException($"Cannot cast '{paramName}' from '{value?.GetType().ToString() ?? "null"}' to '{typeof(T)}'");
Aspire.Microsoft.EntityFrameworkCore.SqlServer (1)
src\Vendoring\OpenTelemetry.Instrumentation.SqlClient\Shared\Guard.cs (1)
177throw new InvalidCastException($"Cannot cast '{paramName}' from '{value?.GetType().ToString() ?? "null"}' to '{typeof(T)}'");
Aspire.StackExchange.Redis (1)
src\Vendoring\OpenTelemetry.Instrumentation.StackExchangeRedis\Shared\Guard.cs (1)
185throw new InvalidCastException($"Cannot cast '{paramName}' from '{value?.GetType().ToString() ?? "null"}' to '{typeof(T)}'");
Crossgen2Tasks (1)
CommonFilePulledFromSdkRepo\MessageLevel.cs (1)
27=> level >= 0 ? (MessageImportance)level : throw new InvalidCastException();
dotnet-svcutil-lib (19)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\XmlBinaryReader.cs (7)
1120throw new InvalidCastException(string.Format(ResXml.XmlBinary_CastNotSupported, _token, "Boolean")); 1210throw new InvalidCastException(string.Format(ResXml.XmlBinary_CastNotSupported, _token, "DateTime")); 1305throw new InvalidCastException(string.Format(ResXml.XmlBinary_CastNotSupported, _token, "Double")); 1400throw new InvalidCastException(string.Format(ResXml.XmlBinary_CastNotSupported, _token, "Float")); 1495throw new InvalidCastException(string.Format(ResXml.XmlBinary_CastNotSupported, _token, "Decimal")); 1590throw new InvalidCastException(string.Format(ResXml.XmlBinary_CastNotSupported, _token, "Int32")); 1685throw new InvalidCastException(string.Format(ResXml.XmlBinary_CastNotSupported, _token, "Int64"));
FrameworkFork\Microsoft.Xml\Xml\schema\XmlValueConverter.cs (9)
564return new InvalidCastException(string.Format(ResXml.XmlConvert_TypeBadMapping, XmlTypeName, sourceType.Name)); 566return new InvalidCastException(string.Format(ResXml.XmlConvert_TypeBadMapping2, XmlTypeName, sourceType.Name, destinationType.Name)); 724throw new InvalidCastException(string.Format(ResXml.XmlConvert_TypeNoNamespace, value, prefix)); 729throw new InvalidCastException(string.Format(ResXml.XmlConvert_TypeNoNamespace, value, prefix)); 855throw new InvalidCastException(string.Format(ResXml.XmlConvert_TypeNoPrefix, qname.ToString(), qname.Namespace)); 2913throw new InvalidCastException(string.Format(ResXml.XmlConvert_TypeToString, XmlTypeName, sourceType.Name)); 2916throw new InvalidCastException(string.Format(ResXml.XmlConvert_TypeFromString, XmlTypeName, destinationType.Name)); 3660return new InvalidCastException(string.Format(ResXml.XmlConvert_TypeListBadMapping, XmlTypeName, sourceType.Name)); 3662return new InvalidCastException(string.Format(ResXml.XmlConvert_TypeListBadMapping2, XmlTypeName, sourceType.Name, destinationType.Name));
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationReader.cs (3)
1414return new InvalidCastException(string.Format(ResXml.XmlInvalidNullCast, type.FullName)); 1416return new InvalidCastException(string.Format(ResXml.XmlInvalidCast, value.GetType().FullName, type.FullName)); 1418return new InvalidCastException(string.Format(ResXml.XmlInvalidCastWithId, value.GetType().FullName, type.FullName, id));
Microsoft.AspNetCore.DataProtection (1)
TypeExtensions.cs (1)
26throw new InvalidCastException(Resources.FormatTypeExtensions_BadCast(
Microsoft.AspNetCore.Mvc.Core.TestCommon (1)
CommonResourceInvokerTest.cs (1)
691var expected = new InvalidCastException();
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (2)
Rendering\HtmlHelperValidationSummaryTest.cs (2)
673modelState.AddModelError("Property3", new InvalidCastException("Exception will be ignored."), metadata); 692modelState.AddModelError("Property3", new InvalidCastException("An ignored Exception."), metadata);
Microsoft.CodeAnalysis.EditorFeatures.Wpf (2)
Lightup\ISmartRenameSessionFactoryWrapper.cs (1)
43throw new InvalidCastException($"Cannot cast '{instance.GetType().FullName}' to '{WrappedTypeName}'");
Lightup\ISmartRenameSessionWrapper.cs (1)
115throw new InvalidCastException($"Cannot cast '{instance.GetType().FullName}' to '{WrappedTypeName}'");
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.Data.Analysis (1)
DataFrame.cs (1)
390throw new InvalidCastException(String.Format(Strings.BadColumnCastDuringGrouping, columnName, column.DataType, typeof(TKey)));
Microsoft.DotNet.Git.IssueManager (3)
Helpers\RepositoryHelper.cs (3)
39throw new InvalidCastException($"'{parsedUri}' is not a valid URI"); 73throw new InvalidCastException($"'{parsedUri}' is not a valid URI"); 101throw new InvalidCastException($"'{parsedUri}' is not a valid URI");
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.Maui.Controls (2)
Compatibility\Handlers\TabbedPage\iOS\TabbedRenderer.cs (1)
461 throw new InvalidCastException($"{nameof(renderer)} must be a {nameof(Page)} renderer.");
DependencyResolver.cs (1)
35 throw new InvalidCastException("Resolved instance is not of the correct type.");
Microsoft.Maui.Controls.Compatibility (1)
iOS\Renderers\TabbedRenderer.cs (1)
470 throw new InvalidCastException($"{nameof(renderer)} must be a {nameof(Page)} renderer.");
Microsoft.VisualBasic.Core (6)
Microsoft\VisualBasic\CompilerServices\ExceptionUtils.vb (1)
245Return New InvalidCastException(Description)
Microsoft\VisualBasic\CompilerServices\NewLateBinding.vb (2)
1394Throw New InvalidCastException(errorMessage) 1470Throw New InvalidCastException(errorMessage)
Microsoft\VisualBasic\CompilerServices\Operators.Resolution.vb (1)
217Throw New InvalidCastException(errorMessage)
Microsoft\VisualBasic\CompilerServices\OverloadResolution.vb (1)
2575Return New InvalidCastException(message)
Microsoft\VisualBasic\CompilerServices\Utils.vb (1)
90Throw New Global.System.InvalidCastException()
Microsoft.VisualStudio.LanguageServices.DevKit (2)
Logging\VSCodeTelemetryLogger.cs (2)
97throw new InvalidCastException($"Unexpected value for scope: {scope}"); 195_ => throw new InvalidCastException($"Unexpected value for scope: {scope}")
PresentationFramework (2)
MS\Internal\Controls\ConnectionPointCookie.cs (2)
50ex = new InvalidCastException(SR.Format(SR.AxNoSinkImplementation, eventInterface.Name)); 66ex = new InvalidCastException(SR.AxNoConnectionPointContainer);
System.Collections.Concurrent (1)
System\Collections\Concurrent\ConcurrentBag.cs (1)
309throw new InvalidCastException(e.Message, e);
System.ComponentModel.Annotations (3)
System\ComponentModel\DataAnnotations\LengthAttribute.cs (1)
67throw new InvalidCastException(SR.Format(SR.LengthAttribute_InvalidValueType, value.GetType()));
System\ComponentModel\DataAnnotations\MaxLengthAttribute.cs (1)
84throw new InvalidCastException(SR.Format(SR.LengthAttribute_InvalidValueType, value.GetType()));
System\ComponentModel\DataAnnotations\MinLengthAttribute.cs (1)
67throw new InvalidCastException(SR.Format(SR.LengthAttribute_InvalidValueType, value.GetType()));
System.Data.Common (2)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (1)
107InvalidCastException e = new InvalidCastException(error, inner);
System\Data\DataSetUtil.cs (1)
35return new InvalidCastException(message);
System.Data.Odbc (3)
Common\System\Data\Common\AdapterUtil.Odbc.cs (2)
70InvalidCastException e = new InvalidCastException(); 406e = new InvalidCastException(message, inner);
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (1)
107InvalidCastException e = new InvalidCastException(error, inner);
System.Linq.Expressions (4)
System\Linq\Expressions\Error.cs (2)
96return new InvalidCastException(Strings.DynamicObjectResultNotAssignable(p0, p1, p2, p3)); 103return new InvalidCastException(Strings.DynamicBinderResultNotAssignable(p0, p1, p2));
System\Linq\Expressions\Interpreter\TypeOperations.cs (2)
308throw new InvalidCastException(); 313throw new InvalidCastException();
System.Private.CoreLib (52)
src\coreclr\nativeaot\Runtime.Base\src\System\Runtime\ExceptionHandling.cs (1)
325ExceptionIDs.InvalidCast => new InvalidCastException(),
src\libraries\System.Private.CoreLib\src\System\Boolean.cs (2)
333throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Boolean", "Char")); 393throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Boolean", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Byte.cs (1)
249throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Byte", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Char.cs (5)
519throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Boolean")); 569throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Single")); 574throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Double")); 579throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "Decimal")); 584throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Char", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Convert.cs (8)
138throw new InvalidCastException(SR.InvalidCast_IConvertible); 162TypeCode.DBNull => throw new InvalidCastException(SR.InvalidCast_DBNull), 163TypeCode.Empty => throw new InvalidCastException(SR.InvalidCast_Empty), 215throw new InvalidCastException(SR.InvalidCast_DBNull); 217throw new InvalidCastException(SR.InvalidCast_Empty); 219throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, value.GetType().FullName, targetType.FullName)); 237throw new InvalidCastException(SR.InvalidCast_CannotCastNullToValueType); 248throw new InvalidCastException(SR.InvalidCast_IConvertible);
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (1)
1973private static InvalidCastException InvalidCast(string to) => new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, nameof(DateTime), to));
src\libraries\System.Private.CoreLib\src\System\DBNull.cs (14)
44throw new InvalidCastException(SR.InvalidCast_FromDBNull); 49throw new InvalidCastException(SR.InvalidCast_FromDBNull); 54throw new InvalidCastException(SR.InvalidCast_FromDBNull); 59throw new InvalidCastException(SR.InvalidCast_FromDBNull); 64throw new InvalidCastException(SR.InvalidCast_FromDBNull); 69throw new InvalidCastException(SR.InvalidCast_FromDBNull); 74throw new InvalidCastException(SR.InvalidCast_FromDBNull); 79throw new InvalidCastException(SR.InvalidCast_FromDBNull); 84throw new InvalidCastException(SR.InvalidCast_FromDBNull); 89throw new InvalidCastException(SR.InvalidCast_FromDBNull); 94throw new InvalidCastException(SR.InvalidCast_FromDBNull); 99throw new InvalidCastException(SR.InvalidCast_FromDBNull); 104throw new InvalidCastException(SR.InvalidCast_FromDBNull); 109throw new InvalidCastException(SR.InvalidCast_FromDBNull);
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (2)
1041throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "Char")); 1101throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Decimal", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Double.cs (2)
459throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Double", "Char")); 519throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Double", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Enum.cs (1)
2190DateTime IConvertible.ToDateTime(IFormatProvider? provider) => throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Enum", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Int16.cs (1)
252throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int16", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Int32.cs (1)
267throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int32", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Int64.cs (1)
264throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Int64", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\SByte.cs (1)
255throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "SByte", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\Single.cs (2)
454throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Single", "Char")); 514throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "Single", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (1)
246throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "UInt16", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (1)
262throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "UInt32", "DateTime"));
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (1)
261throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, "UInt64", "DateTime"));
src\System\Array.CoreCLR.cs (3)
274throw new InvalidCastException(SR.InvalidCast_DownCastArrayElement); 555throw new InvalidCastException(SR.InvalidCast_StoreArrayElement); 591throw new InvalidCastException(SR.InvalidCast_StoreArrayElement);
src\System\Runtime\InteropServices\DynamicInterfaceCastableHelpers.cs (2)
20throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, castable.GetType(), interfaceType)); 30throw new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, castable.GetType(), interfaceType));
src\System\TypedReference.CoreCLR.cs (1)
33static void ThrowInvalidCastException() => throw new InvalidCastException();
System.Private.Windows.Core (5)
System\Value.cs (1)
81throw new InvalidCastException($"{from?.Name ?? "<null>"} cannot be cast to {to.Name}");
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.Private.Xml (19)
System\Xml\BinaryXml\XmlBinaryReader.cs (7)
1109throw new InvalidCastException(SR.Format(SR.XmlBinary_CastNotSupported, _token, "Boolean")); 1199throw new InvalidCastException(SR.Format(SR.XmlBinary_CastNotSupported, _token, "DateTime")); 1294throw new InvalidCastException(SR.Format(SR.XmlBinary_CastNotSupported, _token, "Double")); 1389throw new InvalidCastException(SR.Format(SR.XmlBinary_CastNotSupported, _token, "Float")); 1484throw new InvalidCastException(SR.Format(SR.XmlBinary_CastNotSupported, _token, "Decimal")); 1579throw new InvalidCastException(SR.Format(SR.XmlBinary_CastNotSupported, _token, "Int32")); 1674throw new InvalidCastException(SR.Format(SR.XmlBinary_CastNotSupported, _token, "Int64"));
System\Xml\Schema\XmlValueConverter.cs (9)
478return new InvalidCastException(SR.Format(SR.XmlConvert_TypeBadMapping, XmlTypeName, sourceType.Name)); 480return new InvalidCastException(SR.Format(SR.XmlConvert_TypeBadMapping2, XmlTypeName, sourceType.Name, destinationType.Name)); 639throw new InvalidCastException(SR.Format(SR.XmlConvert_TypeNoNamespace, value, prefix)); 644throw new InvalidCastException(SR.Format(SR.XmlConvert_TypeNoNamespace, value, prefix)); 770throw new InvalidCastException(SR.Format(SR.XmlConvert_TypeNoPrefix, qname, qname.Namespace)); 2493throw new InvalidCastException(SR.Format(SR.XmlConvert_TypeToString, XmlTypeName, sourceType.Name)); 2496throw new InvalidCastException(SR.Format(SR.XmlConvert_TypeFromString, XmlTypeName, destinationType.Name)); 3128return new InvalidCastException(SR.Format(SR.XmlConvert_TypeListBadMapping, XmlTypeName, sourceType.Name)); 3130return new InvalidCastException(SR.Format(SR.XmlConvert_TypeListBadMapping2, XmlTypeName, sourceType.Name, destinationType.Name));
System\Xml\Serialization\XmlSerializationReader.cs (3)
1326return new InvalidCastException(SR.Format(SR.XmlInvalidNullCast, type.FullName)); 1328return new InvalidCastException(SR.Format(SR.XmlInvalidCast, value.GetType().FullName, type.FullName)); 1330return new InvalidCastException(SR.Format(SR.XmlInvalidCastWithId, value.GetType().FullName, type.FullName, id));
System.Reflection.Metadata (1)
System\Reflection\Throw.cs (1)
17throw new InvalidCastException();
System.Runtime.InteropServices (1)
System\Runtime\InteropServices\Marshalling\ComInterfaceMarshaller.cs (1)
82throw new InvalidCastException($"Unable to cast the provided managed object to a COM interface with ID '{TargetInterfaceIID.GetValueOrDefault():B}'");
System.Text.Json (1)
System\Text\Json\ThrowHelper.Serialization.cs (1)
58throw new InvalidCastException(SR.Format(SR.DeserializeUnableToAssignValue, typeOfValue, declaredType));
System.Text.RegularExpressions (1)
System\Text\RegularExpressions\Regex.Timeout.cs (1)
81throw new InvalidCastException(SR.Format(SR.IllegalDefaultRegexMatchTimeoutInAppDomain, DefaultMatchTimeout_ConfigKeyName, defaultTimeout));
System.Windows.Forms (10)
System\Windows\Forms\ActiveX\AxHost.ConnectionPointCookie.cs (2)
29throw new InvalidCastException(SR.AXNoConnectionPointContainer); 39throw new InvalidCastException(string.Format(SR.AXNoSinkImplementation, eventInterface.Name));
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (1)
2653throw new InvalidCastException(SR.DataGridView_InvalidEditingControl);
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonColumn.cs (1)
37throw new InvalidCastException(string.Format(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewButtonCell"));
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxColumn.cs (1)
38throw new InvalidCastException(string.Format(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewCheckBoxCell"));
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxColumn.cs (1)
75throw new InvalidCastException(string.Format(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewComboBoxCell"));
System\Windows\Forms\Controls\DataGridView\DataGridViewImageColumn.cs (1)
45throw new InvalidCastException(string.Format(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewImageCell"));
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkColumn.cs (1)
85throw new InvalidCastException(string.Format(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewLinkCell"));
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxColumn.cs (1)
28throw new InvalidCastException(string.Format(SR.DataGridViewTypeColumn_WrongCellTemplateType, "System.Windows.Forms.DataGridViewTextBoxCell"));
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.DropDownHolder.cs (1)
350throw new InvalidCastException(string.Format(SR.PropertyGridViewEditorCreatedInvalidObject, createType));
614 references to InvalidCastException
dotnet-svcutil-lib (38)
FrameworkFork\Microsoft.Xml\Xml\BinaryXml\XmlBinaryReader.cs (9)
1139catch (InvalidCastException e) 1229catch (InvalidCastException e) 1324catch (InvalidCastException e) 1419catch (InvalidCastException e) 1514catch (InvalidCastException e) 1609catch (InvalidCastException e) 1704catch (InvalidCastException e) 1744catch (InvalidCastException e) 1791catch (InvalidCastException e)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReader.cs (1)
400catch (InvalidCastException e)
FrameworkFork\Microsoft.Xml\Xml\Core\XmlReaderAsync.cs (1)
79catch (InvalidCastException e)
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReader.cs (18)
464catch (InvalidCastException e) 497catch (InvalidCastException e) 530catch (InvalidCastException e) 563catch (InvalidCastException e) 596catch (InvalidCastException e) 629catch (InvalidCastException e) 662catch (InvalidCastException e) 695catch (InvalidCastException e) 741catch (InvalidCastException e) 787catch (InvalidCastException e) 822catch (InvalidCastException e) 857catch (InvalidCastException e) 892catch (InvalidCastException e) 927catch (InvalidCastException e) 962catch (InvalidCastException e) 997catch (InvalidCastException e) 1028catch (InvalidCastException e) 1074catch (InvalidCastException e)
FrameworkFork\Microsoft.Xml\Xml\Core\XsdValidatingReaderAsync.cs (4)
64catch (InvalidCastException e) 113catch (InvalidCastException e) 159catch (InvalidCastException e) 209catch (InvalidCastException e)
FrameworkFork\Microsoft.Xml\Xml\schema\DatatypeImplementation.cs (3)
619catch (InvalidCastException e) 1108catch (InvalidCastException e) 1352catch (InvalidCastException e)
FrameworkFork\Microsoft.Xml\Xml\Serialization\XmlSerializationReader.cs (1)
1647catch (InvalidCastException)
FrameworkFork\System.ServiceModel\System\ServiceModel\Description\WsdlImporter.cs (1)
635catch (InvalidCastException)
Microsoft.Analyzers.Local (3)
ApiLifecycle\Json\JsonValue.cs (3)
429/// <exception cref="System.InvalidCastException"> 451/// <exception cref="System.InvalidCastException"> 473/// <exception cref="System.InvalidCastException">
Microsoft.AspNetCore.Components.Tests (1)
ParameterViewTest.cs (1)
232Assert.Throws<InvalidCastException>(() =>
Microsoft.AspNetCore.DataProtection (1)
TypeExtensions.cs (1)
16/// Throws <see cref="InvalidCastException"/> if <paramref name="implementationType"/>
Microsoft.AspNetCore.DataProtection.Tests (2)
ActivatorTests.cs (2)
62var ex = Assert.Throws<InvalidCastException>(
Microsoft.AspNetCore.Http.Abstractions.Tests (4)
EndpointFilterInvocationContextOfTTests.cs (4)
24Assert.Throws<InvalidCastException>(() => context.GetArgument<string>(1)); 25Assert.Throws<InvalidCastException>(() => context.GetArgument<int>(0)); 26Assert.Throws<InvalidCastException>(() => context.GetArgument<string>(3)); 43Assert.Throws<InvalidCastException>(() => context[0] = 4);
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (2)
ApiResponseTypeProviderTest.cs (2)
526new ProducesResponseTypeAttribute(typeof(InvalidCastException), 400), 550Assert.Equal(typeof(InvalidCastException), responseType.Type);
Microsoft.AspNetCore.Mvc.Core.Test (1)
Infrastructure\ControllerActionInvokerTest.cs (1)
1346await Assert.ThrowsAsync<InvalidCastException>(
Microsoft.AspNetCore.Mvc.Core.TestCommon (3)
CommonResourceInvokerTest.cs (3)
691var expected = new InvalidCastException(); 724var thrown = await Assert.ThrowsAsync<InvalidCastException>(invoker.InvokeAsync);
Microsoft.AspNetCore.Mvc.Razor.Test (1)
RazorPageActivatorTest.cs (1)
166Assert.Throws<InvalidCastException>(() => activator.Activate(instance, viewContext));
Microsoft.Build (9)
BackEnd\TaskExecutionHost\TaskExecutionHost.cs (3)
769if (ex is InvalidCastException || // invalid type 966catch (InvalidCastException e) 1195if (ex is InvalidCastException || // invalid type
Evaluation\Expander.cs (1)
4136catch (InvalidCastException)
ExceptionHandling.cs (2)
256|| e is InvalidCastException 311if (e is InvalidCastException
Instance\HostServices.cs (1)
98catch (Exception ex) when (ex is COMException || ex is InvalidCastException)
Instance\TaskRegistry.cs (1)
1510catch (InvalidCastException e)
Logging\LoggerDescription.cs (1)
222catch (InvalidCastException e)
Microsoft.Build.Engine.OM.UnitTests (2)
ExceptionHandling.cs (2)
256|| e is InvalidCastException 311if (e is InvalidCastException
Microsoft.Build.Framework (7)
SegmentedDictionary`2.cs (4)
1047catch (InvalidCastException) 1052catch (InvalidCastException) 1084catch (InvalidCastException) 1089catch (InvalidCastException)
SegmentedList`1.cs (3)
209catch (InvalidCastException) 255catch (InvalidCastException) 730catch (InvalidCastException)
Microsoft.Build.Tasks.Core (2)
ExceptionHandling.cs (2)
256|| e is InvalidCastException 311if (e is InvalidCastException
Microsoft.Build.Utilities.Core (2)
ExceptionHandling.cs (2)
256|| e is InvalidCastException 311if (e is InvalidCastException
Microsoft.CodeAnalysis (9)
Desktop\AssemblyVersion.cs (1)
106/// <exception cref="InvalidCastException">Major, minor, build or revision number are less than 0 or greater than 0xFFFF.</exception>
Generated\Operations.Generated.cs (1)
729/// False if the conversion will fail with a <see cref="InvalidCastException" /> at runtime if the cast fails. This is true for C#'s
src\Dependencies\Collections\SegmentedDictionary`2.cs (4)
1081catch (InvalidCastException) 1086catch (InvalidCastException) 1118catch (InvalidCastException) 1123catch (InvalidCastException)
src\Dependencies\Collections\SegmentedList`1.cs (3)
236catch (InvalidCastException) 283catch (InvalidCastException) 879catch (InvalidCastException)
Microsoft.CodeAnalysis.CodeStyle (7)
src\Dependencies\Collections\SegmentedDictionary`2.cs (4)
1081catch (InvalidCastException) 1086catch (InvalidCastException) 1118catch (InvalidCastException) 1123catch (InvalidCastException)
src\Dependencies\Collections\SegmentedList`1.cs (3)
236catch (InvalidCastException) 283catch (InvalidCastException) 879catch (InvalidCastException)
Microsoft.CodeAnalysis.Collections.Package (7)
SegmentedDictionary`2.cs (4)
1081catch (InvalidCastException) 1086catch (InvalidCastException) 1118catch (InvalidCastException) 1123catch (InvalidCastException)
SegmentedList`1.cs (3)
236catch (InvalidCastException) 283catch (InvalidCastException) 879catch (InvalidCastException)
Microsoft.CodeAnalysis.CSharp (2)
CSharpExtensions.cs (1)
783/// <exception cref="InvalidCastException">If the <see cref="IConversionOperation"/> was not created from CSharp code.</exception>
Syntax\CSharpSyntaxTree.cs (1)
112/// <exception cref="InvalidCastException">Throws this exception if <see cref="SyntaxTree.HasCompilationUnitRoot"/> is false.</exception>
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\SyntaxTreeRootTests.cs (1)
113Assert.Throws<InvalidCastException>(() => { var _ = (CSharpSyntaxTree)(Object)tree.GetCompilationUnitRoot(); });
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (3)
Compilation\CompilationAPITests.cs (3)
1602Exception invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1607invalidCastSynTreeEx = Assert.Throws<InvalidCastException>( 1612invalidCastSynTreeEx = Assert.Throws<InvalidCastException>(
Microsoft.CodeAnalysis.LanguageServer.Protocol (9)
Protocol\SumType.cs (9)
88/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2}"/> does not contain an instance of <typeparamref name="T1"/>.</exception> 95/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2}"/> does not contain an instance of <typeparamref name="T2"/>.</exception> 336/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2, T3}"/> does not contain an instance of <typeparamref name="T1"/>.</exception> 343/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2, T3}"/> does not contain an instance of <typeparamref name="T2"/>.</exception> 350/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2, T3}"/> does not contain an instance of <typeparamref name="T3"/>.</exception> 682/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T1"/>.</exception> 689/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T2"/>.</exception> 696/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T3"/>.</exception> 703/// <exception cref="InvalidCastException">Thrown if this instance of <see cref="SumType{T1, T2, T3, T4}"/> does not contain an instance of <typeparamref name="T4"/>.</exception>
Microsoft.CodeAnalysis.UnitTests (1)
Collections\List\ICollection.NonGeneric.Tests.cs (1)
58protected virtual Type ICollection_NonGeneric_CopyTo_ArrayOfEnumType_ThrowType => typeof(InvalidCastException);
Microsoft.CodeAnalysis.Workspaces (7)
src\Dependencies\Collections\SegmentedDictionary`2.cs (4)
1081catch (InvalidCastException) 1086catch (InvalidCastException) 1118catch (InvalidCastException) 1123catch (InvalidCastException)
src\Dependencies\Collections\SegmentedList`1.cs (3)
236catch (InvalidCastException) 283catch (InvalidCastException) 879catch (InvalidCastException)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (7)
src\Dependencies\Collections\SegmentedDictionary`2.cs (4)
1081catch (InvalidCastException) 1086catch (InvalidCastException) 1118catch (InvalidCastException) 1123catch (InvalidCastException)
src\Dependencies\Collections\SegmentedList`1.cs (3)
236catch (InvalidCastException) 283catch (InvalidCastException) 879catch (InvalidCastException)
Microsoft.Data.Analysis.Tests (1)
DataFrameGroupByTests.cs (1)
106Assert.Throws<InvalidCastException>(() => df.GroupBy<double>("Tens"));
Microsoft.DotNet.XUnitAssert.Tests (35)
TypeAssertsTests.cs (35)
34 var ex = new InvalidCastException(); 36 Assert.IsAssignableFrom<InvalidCastException>(ex); 42 var ex = new InvalidCastException(); 58 var ex = new InvalidCastException(); 60 var result = Assert.IsAssignableFrom<InvalidCastException>(ex); 70 () => Assert.IsAssignableFrom<InvalidCastException>(new InvalidOperationException()) 103 var ex = new InvalidCastException(); 105 Assert.IsAssignableFrom(typeof(InvalidCastException), ex); 111 var ex = new InvalidCastException(); 127 var ex = new InvalidCastException(); 129 var result = Assert.IsAssignableFrom<InvalidCastException>(ex); 139 () => Assert.IsAssignableFrom(typeof(InvalidCastException), new InvalidOperationException()) 164 var ex = new InvalidCastException(); 166 var result = Record.Exception(() => Assert.IsNotAssignableFrom<InvalidCastException>(ex)); 180 var ex = new InvalidCastException(); 212 Assert.IsNotAssignableFrom<InvalidCastException>(new InvalidOperationException()); 227 var ex = new InvalidCastException(); 229 var result = Record.Exception(() => Assert.IsNotAssignableFrom(typeof(InvalidCastException), ex)); 243 var ex = new InvalidCastException(); 275 Assert.IsNotAssignableFrom(typeof(InvalidCastException), new InvalidOperationException()); 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(); 350 Assert.IsType<InvalidCastException>(ex); 356 var ex = new InvalidCastException(); 358 var result = Assert.IsType<InvalidCastException>(ex); 366 var result = Record.Exception(() => Assert.IsType<InvalidCastException>(new InvalidOperationException())); 420 var ex = new InvalidCastException(); 422 Assert.IsType(typeof(InvalidCastException), ex); 428 var result = Record.Exception(() => Assert.IsType(typeof(InvalidCastException), new InvalidOperationException()));
Microsoft.DotNet.XUnitExtensions (1)
XunitParallelTheoryTestCaseRunner.cs (1)
71catch (InvalidCastException)
Microsoft.Extensions.AI.Abstractions (1)
AdditionalPropertiesDictionary{TValue}.cs (1)
180catch (Exception e) when (e is ArgumentException or FormatException or InvalidCastException or OverflowException)
Microsoft.Extensions.Diagnostics.Testing (1)
Logging\FakeLogRecord.cs (1)
67/// <exception cref="InvalidCastException">The state object is not compatible with supported logging model and is not a read-only list.</exception>
Microsoft.Maui (1)
Platform\iOS\ApplicationExtensions.cs (1)
87 catch (InvalidCastException)
Microsoft.Maui.Controls (3)
BindingExpression.cs (1)
373 catch (InvalidCastException)
BindingExpressionHelper.cs (1)
51 catch (Exception ex) when (ex is InvalidCastException || ex is FormatException || ex is InvalidOperationException || ex is OverflowException)
NameScopeExtensions.cs (1)
16 catch (InvalidCastException ice) when (ResourceLoader.ExceptionHandler2 != null)
Microsoft.VisualBasic.Core (2)
Microsoft\VisualBasic\CompilerServices\ObjectFlowControl.vb (1)
378Catch ex As InvalidCastException
Microsoft\VisualBasic\FileIO\FileSystem.vb (1)
1334TypeOf ex Is InvalidCastException), "Unexpected exception: " & ex.ToString())
MSBuild (2)
ExceptionHandling.cs (2)
256|| e is InvalidCastException 311if (e is InvalidCastException
MSBuildTaskHost (2)
ExceptionHandling.cs (2)
256|| e is InvalidCastException 311if (e is InvalidCastException
mscorlib (1)
src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
305[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.InvalidCastException))]
netstandard (1)
netstandard.cs (1)
881[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.InvalidCastException))]
PresentationCore (32)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\WindowsRuntime\ReflectionHelper.cs (7)
57/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>TResult</i></exception> 90/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>TResult</i></exception> 121/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 204/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 260/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 278/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 384/// <exception cref="InvalidCastException">The result of the property access can not be cast to <i>Result</i> type</exception>
System\Windows\FreezableCollection.cs (1)
495catch (InvalidCastException e)
System\Windows\Generated\TextDecorationCollection.cs (1)
403catch (InvalidCastException e)
System\Windows\Input\Stylus\Wisp\PenThreadWorker.cs (1)
1137|| e is InvalidCastException);
System\Windows\Media\Animation\Generated\TimelineCollection.cs (1)
402catch (InvalidCastException e)
System\Windows\Media\Effects\Generated\BitmapEffectCollection.cs (1)
402catch (InvalidCastException e)
System\Windows\Media\Generated\DoubleCollection.cs (1)
370catch (InvalidCastException e)
System\Windows\Media\Generated\DrawingCollection.cs (1)
415catch (InvalidCastException e)
System\Windows\Media\Generated\GeneralTransformCollection.cs (1)
400catch (InvalidCastException e)
System\Windows\Media\Generated\GeometryCollection.cs (1)
415catch (InvalidCastException e)
System\Windows\Media\Generated\GradientStopCollection.cs (1)
401catch (InvalidCastException e)
System\Windows\Media\Generated\Int32Collection.cs (1)
369catch (InvalidCastException e)
System\Windows\Media\Generated\PathFigureCollection.cs (1)
406catch (InvalidCastException e)
System\Windows\Media\Generated\PathSegmentCollection.cs (1)
400catch (InvalidCastException e)
System\Windows\Media\Generated\PointCollection.cs (1)
369catch (InvalidCastException e)
System\Windows\Media\Generated\TextEffectCollection.cs (1)
400catch (InvalidCastException e)
System\Windows\Media\Generated\TransformCollection.cs (1)
415catch (InvalidCastException e)
System\Windows\Media\Generated\VectorCollection.cs (1)
369catch (InvalidCastException e)
System\Windows\Media3D\Generated\GeneralTransform3DCollection.cs (1)
400catch (InvalidCastException e)
System\Windows\Media3D\Generated\MaterialCollection.cs (1)
415catch (InvalidCastException e)
System\Windows\Media3D\Generated\Model3DCollection.cs (1)
415catch (InvalidCastException e)
System\Windows\Media3D\Generated\Point3DCollection.cs (1)
370catch (InvalidCastException e)
System\Windows\Media3D\Generated\Transform3DCollection.cs (1)
415catch (InvalidCastException e)
System\Windows\Media3D\Generated\Vector3DCollection.cs (1)
370catch (InvalidCastException e)
System\Windows\Media3D\Visual3DCollection.cs (1)
173catch (InvalidCastException e)
System\Windows\Nrbf\SerializationRecordExtensions.cs (1)
22catch (Exception ex) when (ex is KeyNotFoundException or InvalidCastException)
PresentationCore.Tests (2)
System\Windows\Input\MouseActionConverter.Tests.cs (2)
66Assert.Throws<InvalidCastException>(() => converter.CanConvertTo(context, typeof(string))); 175Assert.Throws<InvalidCastException>(() => converter.ConvertTo(null, null, (int)(MouseAction.MiddleDoubleClick), typeof(string)));
PresentationFramework (18)
MS\Internal\IO\Packaging\PackageFilter.cs (2)
286catch(InvalidCastException) 386catch (InvalidCastException)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Internal\WindowsRuntime\ReflectionHelper.cs (7)
57/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>TResult</i></exception> 90/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>TResult</i></exception> 121/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 204/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 260/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 278/// <exception cref="InvalidCastException">The result of the method call cannot be successfully cast to <i>Result</i></exception> 384/// <exception cref="InvalidCastException">The result of the property access can not be cast to <i>Result</i> type</exception>
System\Windows\Controls\ItemsControl.cs (1)
3524catch (System.InvalidCastException)
System\Windows\Controls\Primitives\DocumentViewerBase.cs (1)
1534catch (InvalidCastException) { }
System\Windows\Documents\MsSpellCheckLib\SpellCheckerFactory\SpellCheckerFactory.cs (1)
153catch (InvalidCastException icex)
System\Windows\Documents\MsSpellCheckLib\Utils\ChangeNotifyWrapper.cs (1)
70catch (InvalidCastException)
System\Windows\Documents\WinRTSpellerInterop.cs (1)
46when (ex is InvalidCastException || ex is COMException )
System\Windows\Shell\WindowChrome.cs (1)
274catch (InvalidCastException)
System\Windows\Standard\ErrorCodes.cs (2)
115catch (InvalidCastException) 352catch (InvalidCastException)
System\Windows\Standard\NativeMethods.cs (1)
2045catch (InvalidCastException)
System.Collections (5)
System\Collections\Generic\SortedDictionary.cs (4)
326catch (InvalidCastException) 331catch (InvalidCastException) 355catch (InvalidCastException) 360catch (InvalidCastException)
System\Collections\Generic\SortedList.cs (1)
625catch (InvalidCastException)
System.Collections.Concurrent (1)
System\Collections\Concurrent\BlockingCollection.cs (1)
1584catch (InvalidCastException)
System.Collections.Immutable (1)
System\Collections\Immutable\ImmutableArray_1.Minimal.cs (1)
348/// <exception cref="InvalidCastException">Thrown if the cast is illegal.</exception>
System.ComponentModel.Annotations (2)
System\ComponentModel\DataAnnotations\CustomValidationAttribute.cs (1)
338catch (InvalidCastException)
System\ComponentModel\DataAnnotations\RangeAttribute.cs (1)
152catch (InvalidCastException)
System.ComponentModel.Composition (8)
System\ComponentModel\Composition\CatalogReflectionContextAttribute.cs (1)
37catch (InvalidCastException invalidCastException)
System\ComponentModel\Composition\CompositionContractMismatchException.cs (1)
77/// <exception cref="InvalidCastException">
System\ComponentModel\Composition\ImportCardinalityMismatchException.cs (1)
80/// <exception cref="InvalidCastException">
System\ComponentModel\Composition\MetadataViewGenerator.cs (3)
269proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException)); 293proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException)); 346proxyCtorIL.BeginCatchBlock(typeof(InvalidCastException));
System\ComponentModel\Composition\MetadataViewProvider.cs (1)
100if (ex.InnerException!.GetType() == typeof(InvalidCastException))
System\ComponentModel\Composition\Primitives\ComposablePartException.cs (1)
47/// <exception cref="InvalidCastException">
System.ComponentModel.TypeConverter (4)
System\ComponentModel\BindingList.cs (1)
489catch (InvalidCastException)
System\ComponentModel\TypeDescriptor.cs (3)
2093catch (InvalidCastException) 2106catch (InvalidCastException) 2119catch (InvalidCastException)
System.Data.Common (15)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (4)
100internal static InvalidCastException InvalidCast(string error) 105internal static InvalidCastException InvalidCast(string error, Exception? inner) 107InvalidCastException e = new InvalidCastException(error, inner); 326internal static InvalidCastException CollectionInvalidType(Type collection, Type itemType, object invalidValue)
System\Data\Common\DbConnectionStringBuilder.cs (1)
348catch (InvalidCastException)
System\Data\Common\DbConnectionStringCommon.cs (1)
19catch (InvalidCastException e)
System\Data\DataColumn.cs (2)
535catch (InvalidCastException ex) 689catch (InvalidCastException ex)
System\Data\DataSetUtil.cs (1)
33internal static InvalidCastException InvalidCast(string message)
System\Data\Filter\BinaryNode.cs (1)
266catch (System.InvalidCastException e)
System\Data\Filter\ConstNode.cs (5)
154catch (System.InvalidCastException e) 174catch (System.InvalidCastException e) 232catch (System.InvalidCastException e) 253catch (System.InvalidCastException e) 274catch (System.InvalidCastException e)
System.Data.Odbc (11)
Common\System\Data\Common\AdapterUtil.Odbc.cs (3)
68internal static InvalidCastException InvalidCast() 70InvalidCastException e = new InvalidCastException(); 404else if (inner is InvalidCastException)
Common\System\Data\Common\DbConnectionStringCommon.cs (4)
188catch (InvalidCastException e) 227catch (InvalidCastException e) 239catch (InvalidCastException e) 251catch (InvalidCastException e)
src\libraries\Common\src\System\Data\Common\AdapterUtil.cs (4)
100internal static InvalidCastException InvalidCast(string error) 105internal static InvalidCastException InvalidCast(string error, Exception? inner) 107InvalidCastException e = new InvalidCastException(error, inner); 326internal static InvalidCastException CollectionInvalidType(Type collection, Type itemType, object invalidValue)
System.Linq.Expressions (6)
System\Dynamic\Utils\CachedReflectionInfo.cs (1)
18s_InvalidCastException_Ctor_String ??= typeof(InvalidCastException).GetConstructor(new Type[] { typeof(string) })!;
System\Linq\Expressions\Error.cs (2)
94internal static InvalidCastException DynamicObjectResultNotAssignable(object? p0, object? p1, object? p2, object? p3) 101internal static InvalidCastException DynamicBinderResultNotAssignable(object? p0, object? p1, object? p2)
System\Runtime\CompilerServices\ReadOnlyCollectionBuilder.cs (3)
278catch (InvalidCastException) 310catch (InvalidCastException) 340catch (InvalidCastException)
System.Private.CoreLib (13)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\Dictionary.cs (4)
1673catch (InvalidCastException) 1678catch (InvalidCastException) 1710catch (InvalidCastException) 1715catch (InvalidCastException)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\List.cs (3)
184catch (InvalidCastException) 231catch (InvalidCastException) 798catch (InvalidCastException)
src\libraries\System.Private.CoreLib\src\System\Collections\ObjectModel\Collection.cs (3)
254catch (InvalidCastException) 295catch (InvalidCastException) 337catch (InvalidCastException)
src\libraries\System.Private.CoreLib\src\System\DateTime.cs (1)
1973private static InvalidCastException InvalidCast(string to) => new InvalidCastException(SR.Format(SR.InvalidCast_FromTo, nameof(DateTime), to));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\IDynamicInterfaceCastable.cs (1)
29/// true and this function returns false, then <see cref="InvalidCastException" />
src\libraries\System.Private.CoreLib\src\System\RuntimeType.cs (1)
494catch (InvalidCastException)
System.Private.Windows.Core (3)
System\Private\Windows\Nrbf\SerializationRecordExtensions.cs (2)
31catch (Exception ex) when (ex is ArgumentException or InvalidCastException or ArithmeticException or IOException or TargetInvocationException) 71catch (Exception ex) when (ex is KeyNotFoundException or InvalidCastException)
System\Value.cs (1)
1038/// <exception cref="InvalidCastException">
System.Private.Windows.Core.Tests (11)
System\Value\StoringArrays.cs (8)
19Assert.Throws<InvalidCastException>(() => value.GetValue<ArraySegment<byte>>()); 33Assert.Throws<InvalidCastException>(() => value.GetValue<ArraySegment<char>>()); 47Assert.Throws<InvalidCastException>(() => value.GetValue<byte[]>()); 54Assert.Throws<InvalidCastException>(() => value.GetValue<byte[]>()); 61Assert.Throws<InvalidCastException>(() => value.GetValue<byte[]>()); 75Assert.Throws<InvalidCastException>(() => value.GetValue<char[]>()); 82Assert.Throws<InvalidCastException>(() => value.GetValue<char[]>()); 89Assert.Throws<InvalidCastException>(() => value.GetValue<char[]>());
System\Value\StoringNull.cs (2)
12Assert.Throws<InvalidCastException>(() => _ = nullValue.GetValue<int>()); 15Assert.Throws<InvalidCastException>(() => _ = nullFastValue.GetValue<int>());
System\Value\StoringObject.cs (1)
34Assert.Throws<InvalidCastException>(() => value.GetValue<C>());
System.Private.Xml (39)
System\Xml\BinaryXml\XmlBinaryReader.cs (9)
1128catch (InvalidCastException e) 1218catch (InvalidCastException e) 1313catch (InvalidCastException e) 1408catch (InvalidCastException e) 1503catch (InvalidCastException e) 1598catch (InvalidCastException e) 1693catch (InvalidCastException e) 1733catch (InvalidCastException e) 1780catch (InvalidCastException e)
System\Xml\Core\XmlReader.cs (1)
339catch (InvalidCastException e)
System\Xml\Core\XmlReaderAsync.cs (1)
67catch (InvalidCastException e)
System\Xml\Core\XsdValidatingReader.cs (18)
476catch (InvalidCastException e) 510catch (InvalidCastException e) 544catch (InvalidCastException e) 578catch (InvalidCastException e) 612catch (InvalidCastException e) 646catch (InvalidCastException e) 681catch (InvalidCastException e) 716catch (InvalidCastException e) 762catch (InvalidCastException e) 808catch (InvalidCastException e) 843catch (InvalidCastException e) 878catch (InvalidCastException e) 913catch (InvalidCastException e) 948catch (InvalidCastException e) 983catch (InvalidCastException e) 1018catch (InvalidCastException e) 1049catch (InvalidCastException e) 1096catch (InvalidCastException e)
System\Xml\Core\XsdValidatingReaderAsync.cs (4)
61catch (InvalidCastException e) 112catch (InvalidCastException e) 160catch (InvalidCastException e) 212catch (InvalidCastException e)
System\Xml\Schema\DataTypeImplementation.cs (3)
605catch (InvalidCastException e) 1073catch (InvalidCastException e) 1328catch (InvalidCastException e)
System\Xml\Schema\XmlValueConverter.cs (1)
3125private new InvalidCastException CreateInvalidClrMappingException(Type sourceType, Type destinationType)
System\Xml\Serialization\XmlSerializationReader.cs (2)
1545catch (InvalidCastException) 5102WriteCatchException(typeof(InvalidCastException));
System.Resources.Extensions (2)
System\Resources\Extensions\BinaryFormat\BinaryFormattedObject.cs (2)
51catch (Exception ex) when (ex is ArgumentException or InvalidCastException or ArithmeticException or IOException) 72catch (Exception ex) when (ex is ArgumentException or InvalidCastException or ArithmeticException or IOException)
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
284[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.InvalidCastException))]
System.Text.Json (10)
System\Text\Json\Serialization\JsonSerializer.Read.HandleMetadata.cs (1)
529catch (InvalidCastException)
System\Text\Json\Serialization\JsonSerializer.Write.ByteArray.cs (1)
91/// <exception cref="InvalidCastException">
System\Text\Json\Serialization\JsonSerializer.Write.Document.cs (1)
88/// <exception cref="InvalidCastException">
System\Text\Json\Serialization\JsonSerializer.Write.Element.cs (1)
88/// <exception cref="InvalidCastException">
System\Text\Json\Serialization\JsonSerializer.Write.Node.cs (1)
89/// <exception cref="InvalidCastException">
System\Text\Json\Serialization\JsonSerializer.Write.Pipe.cs (1)
90/// <exception cref="InvalidCastException">
System\Text\Json\Serialization\JsonSerializer.Write.Stream.cs (2)
229/// <exception cref="InvalidCastException"> 260/// <exception cref="InvalidCastException">
System\Text\Json\Serialization\JsonSerializer.Write.String.cs (1)
103/// <exception cref="InvalidCastException">
System\Text\Json\Serialization\JsonSerializer.Write.Utf8JsonWriter.cs (1)
111/// <exception cref="InvalidCastException">
System.Windows.Forms (5)
System\Windows\Forms\Controls\Labels\LinkArea.LinkAreaConverter.cs (1)
129catch (InvalidCastException invalidCast)
System\Windows\Forms\Controls\MonthCalendar\SelectionRangeConverter.cs (1)
148catch (InvalidCastException invalidCast)
System\Windows\Forms\DataBinding\ListBindingConverter.cs (1)
91catch (InvalidCastException invalidCast)
System\Windows\Forms\Internal\Formatter.cs (1)
388catch (InvalidCastException ex)
System\Windows\Forms\Panels\TableLayoutPanel\TableLayoutPanelCellPositionTypeConverter.cs (1)
86catch (InvalidCastException invalidCast)
System.Windows.Forms.Design (1)
System\ComponentModel\Design\Serialization\DesignerSerializationManager.cs (1)
329catch (InvalidCastException)
System.Windows.Forms.Design.Tests (2)
System\ComponentModel\Design\DesignerCommandSetTests.cs (2)
44Assert.Throws<InvalidCastException>(() => mockSet.Object.Verbs); 65Assert.Throws<InvalidCastException>(() => mockSet.Object.ActionLists);
System.Windows.Forms.Primitives (1)
System\Windows\Forms\PaddingConverter.cs (1)
99catch (InvalidCastException invalidCast)
System.Windows.Forms.Primitives.TestUtilities (1)
PlatformDetection.Windows.cs (1)
183catch (Exception e) when (e is SecurityException or InvalidCastException or PlatformNotSupportedException /* UAP */)
System.Windows.Forms.Tests (31)
System\Windows\Forms\AxHost.ConnectionPointCookieTests.cs (4)
37Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, null, null)); 38Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, new object(), typeof(int))); 58Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, null, eventInterface)); 74Assert.Throws<InvalidCastException>(() => new AxHost.ConnectionPointCookie(source, sink, eventInterface));
System\Windows\Forms\AxHostTests.cs (3)
1440Assert.Throws<InvalidCastException>(() => SubAxHost.GetFontFromIFont(new object())); 1601Assert.Throws<InvalidCastException>(() => SubAxHost.GetPictureFromIPicture(iPicture)); 1735Assert.Throws<InvalidCastException>(() => SubAxHost.GetPictureFromIPicture(new object()));
System\Windows\Forms\DataGridViewButtonColumnTests.cs (1)
163action.Should().Throw<InvalidCastException>();
System\Windows\Forms\DataGridViewLinkColumnTests.cs (1)
85action.Should().Throw<InvalidCastException>()
System\Windows\Forms\DataGridViewTextBoxColumnTests.cs (1)
50action.Should().Throw<InvalidCastException>()
System\Windows\Forms\DataGridViewTextBoxEditingControlTests.cs (1)
285Assert.Throws<InvalidCastException>(() => control.EditingControlFormattedValue = new object());
System\Windows\Forms\HtmlDocumentTests.cs (1)
1647Assert.Throws<InvalidCastException>(() => document.Equals(new object()));
System\Windows\Forms\Layout\TableLayoutSettingsTypeConverterTests.cs (3)
260Assert.Throws<InvalidCastException>(() => settings.ColumnStyles.Add(new RowStyle())); 263Assert.Throws<InvalidCastException>(() => converter.ConvertTo(settings, typeof(string))); 274Assert.Throws<InvalidCastException>(() => converter.ConvertTo(settings, typeof(string)));
System\Windows\Forms\PropertyGridTests.cs (1)
2395Assert.Throws<InvalidCastException>(() => control.SelectedGridItem = mockGridItem.Object);
System\Windows\Forms\PropertyStoreTests.cs (5)
106action.Should().Throw<InvalidCastException>(); 116action.Should().Throw<InvalidCastException>(); 126action.Should().Throw<InvalidCastException>(); 224action.Should().Throw<InvalidCastException>(); 230action.Should().Throw<InvalidCastException>();
System\Windows\Forms\TabControl.TabPageCollectionTests.cs (2)
1292Assert.Throws<InvalidCastException>(() => iList.CopyTo(array, 1)); 1843Assert.Throws<InvalidCastException>(collection.GetEnumerator);
System\Windows\Forms\TabControlTests.cs (2)
3903Assert.Throws<InvalidCastException>(() => control.GetItems(baseType)); 3914Assert.Throws<InvalidCastException>(() => control.GetItems(typeof(int)));
System\Windows\Forms\TableLayoutColumnStyleCollectionTests.cs (3)
28Assert.Throws<InvalidCastException>(() => collection.Add(style)); 64Assert.Throws<InvalidCastException>(() => collection.Add(new RowStyle())); 65Assert.Throws<InvalidCastException>(() => collection[0]);
System\Windows\Forms\TableLayoutRowStyleCollectionTests.cs (1)
65Assert.Throws<InvalidCastException>(() => collection[0]);
System\Windows\Forms\TableLayoutStyleCollectionTests.cs (1)
63Assert.Throws<InvalidCastException>(() => collection.Add(new object()));
System\Windows\Forms\WebBrowserTests.cs (1)
2376Assert.Throws<InvalidCastException>(() => control.AttachInterfaces(new object()));
System.Xaml (2)
System\Windows\Markup\ArrayExtension.cs (1)
92catch (InvalidCastException)
System\Xaml\InfosetObjects\XamlObjectWriter.cs (1)
1894!(ex.InnerException is InvalidCastException))
System.Xaml.Tests (44)
System\Windows\Markup\NameReferenceConverterTests.cs (2)
100Assert.Throws<InvalidCastException>(() => converter.ConvertFrom(context, null, "name")); 192Assert.Throws<InvalidCastException>(() => converter.ConvertTo(context, null, "value", null));
System\Windows\Markup\StringValueSerializerTests.cs (1)
37Assert.Throws<InvalidCastException>(() => serializer.ConvertToString(1, null));
System\Windows\Markup\ValueSerializerTests.cs (4)
235Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(typeof(ClassWithInvalidValueSerializerAttribute))); 236Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(typeof(ClassWithInvalidValueSerializerAttribute), null)); 301Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(descriptor)); 302Assert.Throws<InvalidCastException>(() => ValueSerializer.GetSerializerFor(descriptor, null));
System\Xaml\Schema\XamlValueConverterTests.cs (1)
95Assert.Throws<InvalidCastException>(() => converter.ConverterInstance);
System\Xaml\XamlBackgroundReaderTests.cs (1)
55Assert.Throws<InvalidCastException>(() => new XamlBackgroundReader(new SubXamlReader()));
System\Xaml\XamlMemberTests.cs (11)
513Assert.Throws<InvalidCastException>(() => member.LookupDeferringLoaderEntry()); 514Assert.Throws<InvalidCastException>(() => member.DeferringLoader); 673Assert.Throws<InvalidCastException>(() => member.LookupDependsOnEntry()); 674Assert.Throws<InvalidCastException>(() => member.DependsOn); 1391Assert.Throws<InvalidCastException>(() => member.LookupMarkupExtensionBracketCharactersEntry()); 1392Assert.Throws<InvalidCastException>(() => member.MarkupExtensionBracketCharacters); 1513Assert.Throws<InvalidCastException>(() => member.SerializationVisibility); 1805Assert.Throws<InvalidCastException>(() => member.LookupTypeConverterEntry()); 1806Assert.Throws<InvalidCastException>(() => member.TypeConverter); 2156Assert.Throws<InvalidCastException>(() => member.LookupValueSerializerEntry()); 2157Assert.Throws<InvalidCastException>(() => member.ValueSerializer);
System\Xaml\XamlSchemaContextTests.cs (2)
358Assert.Throws<InvalidCastException>(() => context.GetPreferredPrefix("xmlns")); 386Assert.Throws<InvalidCastException>(() => context.GetPreferredPrefix("xmlns"));
System\Xaml\XamlTypeTests.cs (22)
390Assert.Throws<InvalidCastException>(() => type.GetXamlNamespaces()); 422Assert.Throws<InvalidCastException>(() => type.GetXamlNamespaces()); 675Assert.Throws<InvalidCastException>(() => type.LookupAliasedPropertyEntry(directive)); 676Assert.Throws<InvalidCastException>(() => type.GetAliasedProperty(directive)); 1479Assert.Throws<InvalidCastException>(() => type.LookupAllowedContentTypesEntry()); 1480Assert.Throws<InvalidCastException>(() => type.AllowedContentTypes); 2083Assert.Throws<InvalidCastException>(() => type.LookupContentPropertyEntry()); 2084Assert.Throws<InvalidCastException>(() => type.ContentProperty); 2267Assert.Throws<InvalidCastException>(() => type.LookupContentWrappersEntry()); 2268Assert.Throws<InvalidCastException>(() => type.ContentWrappers); 2446Assert.Throws<InvalidCastException>(() => type.LookupDeferringLoaderEntry()); 2447Assert.Throws<InvalidCastException>(() => type.DeferringLoader); 3417Assert.Throws<InvalidCastException>(() => type.LookupMarkupExtensionReturnTypeEntry()); 3418Assert.Throws<InvalidCastException>(() => type.MarkupExtensionReturnType); 3848Assert.Throws<InvalidCastException>(() => type.LookupSetMarkupExtensionHandlerEntry()); 4047Assert.Throws<InvalidCastException>(() => type.LookupSetTypeConverterHandlerEntry()); 4345Assert.Throws<InvalidCastException>(() => type.LookupTypeConverterEntry()); 4346Assert.Throws<InvalidCastException>(() => type.TypeConverter); 4575Assert.Throws<InvalidCastException>(() => type.LookupUsableDuringInitializationEntry()); 4576Assert.Throws<InvalidCastException>(() => type.IsUsableDuringInitialization); 4753Assert.Throws<InvalidCastException>(() => type.LookupValueSerializerEntry()); 4754Assert.Throws<InvalidCastException>(() => type.ValueSerializer);
UIAutomationClientSideProviders (2)
MS\Internal\AutomationProxies\Accessible.cs (2)
177catch (InvalidCastException) 1378else if (e is InvalidCastException)
WindowsBase.Tests (158)
System\Windows\DependencyPropertyChangedEventArgsTests.cs (1)
86Assert.Throws<InvalidCastException>(() => args.Equals(new object()));
System\Windows\Input\KeyConverterTests.cs (4)
81Assert.Throws<InvalidCastException>(() => converter.CanConvertTo(context, typeof(string))); 179Assert.Throws<InvalidCastException>(() => converter.ConvertTo(value, typeof(string))); 180Assert.Throws<InvalidCastException>(() => converter.ConvertTo(new CustomTypeDescriptorContext(), null, value, typeof(string))); 181Assert.Throws<InvalidCastException>(() => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, value, typeof(string)));
System\Windows\Input\KeyValueSerializerTests.cs (2)
78Assert.Throws<InvalidCastException>(() => serializer.ConvertToString(value, null)); 79Assert.Throws<InvalidCastException>(() => serializer.ConvertToString(value, new CustomValueSerializerContext()));
System\Windows\Input\ModifierKeysConverterTests.cs (3)
145Assert.Throws<InvalidCastException>(() => converter.ConvertTo(value, typeof(string))); 146Assert.Throws<InvalidCastException>(() => converter.ConvertTo(new CustomTypeDescriptorContext(), null, value, typeof(string))); 147Assert.Throws<InvalidCastException>(() => converter.ConvertTo(new CustomTypeDescriptorContext(), CultureInfo.InvariantCulture, value, typeof(string)));
System\Windows\Input\ModifierKeysValueSerializerTests.cs (2)
74Assert.Throws<InvalidCastException>(() => serializer.ConvertToString(value, null)); 75Assert.Throws<InvalidCastException>(() => serializer.ConvertToString(value, new CustomValueSerializerContext()));
System\Windows\LocalValueEntryTests.cs (1)
89Assert.Throws<InvalidCastException>(() => entry.Equals(new object()));
System\Windows\WeakEventManagerTests.cs (145)
337Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 352Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 368Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 425Assert.Throws<InvalidCastException>(() => manager.DeliverEvent(source, args)); 612Assert.Throws<InvalidCastException>(() => manager.DeliverEventToList(sender, args, list)); 625Assert.Throws<InvalidCastException>(() => manager.DeliverEventToList(sender, args, list)); 639Assert.Throws<InvalidCastException>(() => manager.DeliverEventToList(sender, args, list)); 801Assert.Throws<InvalidCastException>(() => list[1]); 812Assert.Throws<InvalidCastException>(() => list[1]); 816Assert.Throws<InvalidCastException>(() => list[0]); 826Assert.Throws<InvalidCastException>(() => list[1]); 830Assert.Throws<InvalidCastException>(() => list[0]); 964Assert.Throws<InvalidCastException>(() => list[0]); 973Assert.Throws<InvalidCastException>(() => list[0]); 974Assert.Throws<InvalidCastException>(() => list[1]); 1237Assert.Throws<InvalidCastException>(() => manager.ProtectedAddHandler(source, handler)); 1375Assert.Throws<InvalidCastException>(() => list[0]); 1383Assert.Throws<InvalidCastException>(() => list[0]); 1602Assert.Throws<InvalidCastException>(() => manager.ProtectedAddListener(source, listener)); 1640Assert.Throws<InvalidCastException>(() => list[0]); 1641Assert.Throws<InvalidCastException>(() => list[1]); 1653Assert.Throws<InvalidCastException>(() => list[0]); 1654Assert.Throws<InvalidCastException>(() => list[1]); 1664Assert.Throws<InvalidCastException>(() => list[0]); 1665Assert.Throws<InvalidCastException>(() => list[1]); 1675Assert.Throws<InvalidCastException>(() => list[0]); 1715Assert.Throws<InvalidCastException>(() => list[0]); 2141Assert.Throws<InvalidCastException>(() => manager.ProtectedRemoveHandler(source, handler)); 2280Assert.Throws<InvalidCastException>(() => list[0]); 2565Assert.Throws<InvalidCastException>(() => manager.ProtectedRemoveListener(source, listener)); 2684Assert.Throws<InvalidCastException>(() => manager.Purge(source, new object(), false)); 2823Assert.Throws<InvalidCastException>(() => manager.Purge(source, new object(), false)); 2986Assert.Throws<InvalidCastException>(() => list[1]); 2990Assert.Throws<InvalidCastException>(() => list[0]); 2998Assert.Throws<InvalidCastException>(() => list[1]); 3002Assert.Throws<InvalidCastException>(() => list[0]); 3035Assert.Throws<InvalidCastException>(() => list[3]); 3040Assert.Throws<InvalidCastException>(() => list[1]); 3050Assert.Throws<InvalidCastException>(() => list[3]); 3055Assert.Throws<InvalidCastException>(() => list[1]); 3339Assert.Throws<InvalidCastException>(() => list[0]); 3351Assert.Throws<InvalidCastException>(() => list[0]); 3460Assert.Throws<InvalidCastException>(() => list[2]); 3468Assert.Throws<InvalidCastException>(() => list[2]); 3477Assert.Throws<InvalidCastException>(() => list[2]); 3487Assert.Throws<InvalidCastException>(() => list[2]); 3498Assert.Throws<InvalidCastException>(() => list[2]); 3510Assert.Throws<InvalidCastException>(() => list[2]); 3617Assert.Throws<InvalidCastException>(() => list[2]); 3625Assert.Throws<InvalidCastException>(() => list[2]); 3626Assert.Throws<InvalidCastException>(() => list[3]); 3634Assert.Throws<InvalidCastException>(() => list[2]); 3635Assert.Throws<InvalidCastException>(() => list[3]); 3636Assert.Throws<InvalidCastException>(() => list[4]); 3644Assert.Throws<InvalidCastException>(() => list[2]); 3645Assert.Throws<InvalidCastException>(() => list[3]); 3646Assert.Throws<InvalidCastException>(() => list[4]); 3647Assert.Throws<InvalidCastException>(() => list[5]); 3655Assert.Throws<InvalidCastException>(() => list[2]); 3656Assert.Throws<InvalidCastException>(() => list[3]); 3657Assert.Throws<InvalidCastException>(() => list[4]); 3658Assert.Throws<InvalidCastException>(() => list[5]); 3667Assert.Throws<InvalidCastException>(() => list[2]); 3668Assert.Throws<InvalidCastException>(() => list[3]); 3669Assert.Throws<InvalidCastException>(() => list[4]); 3670Assert.Throws<InvalidCastException>(() => list[5]); 3793Assert.Throws<InvalidCastException>(() => list[0]); 3799Assert.Throws<InvalidCastException>(() => list[0]); 3800Assert.Throws<InvalidCastException>(() => list[1]); 3806Assert.Throws<InvalidCastException>(() => list[0]); 3807Assert.Throws<InvalidCastException>(() => list[1]); 3808Assert.Throws<InvalidCastException>(() => list[2]); 3821Assert.Throws<InvalidCastException>(() => list[0]); 3827Assert.Throws<InvalidCastException>(() => list[0]); 3828Assert.Throws<InvalidCastException>(() => list[1]); 3834Assert.Throws<InvalidCastException>(() => list[0]); 3835Assert.Throws<InvalidCastException>(() => list[1]); 3836Assert.Throws<InvalidCastException>(() => list[2]); 3874Assert.Throws<InvalidCastException>(() => list[0]); 3983Assert.Throws<InvalidCastException>(() => list[2]); 3984Assert.Throws<InvalidCastException>(() => list[3]); 3989Assert.Throws<InvalidCastException>(() => newList[2]); 3990Assert.Throws<InvalidCastException>(() => newList[3]); 4021Assert.Throws<InvalidCastException>(() => list[4]); 4022Assert.Throws<InvalidCastException>(() => list[5]); 4029Assert.Throws<InvalidCastException>(() => newList[4]); 4030Assert.Throws<InvalidCastException>(() => newList[5]); 4090Assert.Throws<InvalidCastException>(() => newList[2]); 4091Assert.Throws<InvalidCastException>(() => newList[3]); 4124Assert.Throws<InvalidCastException>(() => newList[4]); 4125Assert.Throws<InvalidCastException>(() => newList[5]); 4171Assert.Throws<InvalidCastException>(() => list[2]); 4172Assert.Throws<InvalidCastException>(() => list[3]); 4177Assert.Throws<InvalidCastException>(() => newList[2]); 4178Assert.Throws<InvalidCastException>(() => newList[3]); 4209Assert.Throws<InvalidCastException>(() => list[4]); 4210Assert.Throws<InvalidCastException>(() => list[5]); 4217Assert.Throws<InvalidCastException>(() => newList[4]); 4218Assert.Throws<InvalidCastException>(() => newList[5]); 4473Assert.Throws<InvalidCastException>(() => list.DeliverEvent(sender, args, managerType)); 4484Assert.Throws<InvalidCastException>(() => list.DeliverEvent(sender, args, managerType)); 4496Assert.Throws<InvalidCastException>(() => list.DeliverEvent(sender, args, managerType)); 4606Assert.Throws<InvalidCastException>(() => list[1]); 4607Assert.Throws<InvalidCastException>(() => list[2]); 4632Assert.Throws<InvalidCastException>(() => list[3]); 4633Assert.Throws<InvalidCastException>(() => list[4]); 4703Assert.Throws<InvalidCastException>(() => list[0]); 4709Assert.Throws<InvalidCastException>(() => list[0]); 4715Assert.Throws<InvalidCastException>(() => list[0]); 4780Assert.Throws<InvalidCastException>(() => list[1]); 4788Assert.Throws<InvalidCastException>(() => list[1]); 4794Assert.Throws<InvalidCastException>(() => list[0]); 4800Assert.Throws<InvalidCastException>(() => list[0]); 4806Assert.Throws<InvalidCastException>(() => list[0]); 4884Assert.Throws<InvalidCastException>(() => list[1]); 4892Assert.Throws<InvalidCastException>(() => list[1]); 4899Assert.Throws<InvalidCastException>(() => list[0]); 4906Assert.Throws<InvalidCastException>(() => list[0]); 4913Assert.Throws<InvalidCastException>(() => list[0]); 4919Assert.Throws<InvalidCastException>(() => list[0]); 5015Assert.Throws<InvalidCastException>(() => list[1]); 5026Assert.Throws<InvalidCastException>(() => list[1]); 5036Assert.Throws<InvalidCastException>(() => list[1]); 5044Assert.Throws<InvalidCastException>(() => list[0]); 5052Assert.Throws<InvalidCastException>(() => list[0]); 5061Assert.Throws<InvalidCastException>(() => list[0]); 5067Assert.Throws<InvalidCastException>(() => list[0]); 5172Assert.Throws<InvalidCastException>(() => list[1]); 5184Assert.Throws<InvalidCastException>(() => list[1]); 5195Assert.Throws<InvalidCastException>(() => list[1]); 5204Assert.Throws<InvalidCastException>(() => list[0]); 5213Assert.Throws<InvalidCastException>(() => list[0]); 5224Assert.Throws<InvalidCastException>(() => list[0]); 5230Assert.Throws<InvalidCastException>(() => list[0]); 5745Assert.Throws<InvalidCastException>(() => list[2]); 5746Assert.Throws<InvalidCastException>(() => list[3]); 5751Assert.Throws<InvalidCastException>(() => newList[2]); 5752Assert.Throws<InvalidCastException>(() => newList[3]); 5783Assert.Throws<InvalidCastException>(() => list[4]); 5784Assert.Throws<InvalidCastException>(() => list[5]); 5791Assert.Throws<InvalidCastException>(() => newList[4]); 5792Assert.Throws<InvalidCastException>(() => newList[5]); 5991Assert.Throws<InvalidCastException>(() => list.DeliverEvent(sender, args, managerType)); 6002Assert.Throws<InvalidCastException>(() => list.DeliverEvent(sender, args, managerType)); 6014Assert.Throws<InvalidCastException>(() => list.DeliverEvent(sender, args, managerType));
xunit.assert (1)
Sdk\AssertHelper.cs (1)
324 catch (InvalidCastException)