Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Reflection / ReflectionTypeLoadException.cs / 1305376 / ReflectionTypeLoadException.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // // ReflectionTypeLoadException is thrown when multiple TypeLoadExceptions may occur. // //[....] // Specifically, when you call Module.GetTypes() this causes multiple class loads to occur. // If there are failures, we continue to load classes and build an array of the successfully // loaded classes. We also build an array of the errors that occur. Then we throw this exception // which exposes both the array of classes and the array of TypeLoadExceptions. // // // // namespace System.Reflection { using System; using System.Runtime.Serialization; using System.Security.Permissions; using System.Diagnostics.Contracts; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public sealed class ReflectionTypeLoadException : SystemException, ISerializable { private Type[] _classes; private Exception[] _exceptions; // private constructor. This is not called. private ReflectionTypeLoadException() : base(Environment.GetResourceString("ReflectionTypeLoad_LoadFailed")) { SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } // private constructor. This is called from inside the runtime. private ReflectionTypeLoadException(String message) : base(message) { SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions) : base(null) { _classes = classes; _exceptions = exceptions; SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, String message) : base(message) { _classes = classes; _exceptions = exceptions; SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } internal ReflectionTypeLoadException(SerializationInfo info, StreamingContext context) : base (info, context) { _classes = (Type[])(info.GetValue("Types", typeof(Type[]))); _exceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[]))); } public Type[] Types { get {return _classes;} } public Exception[] LoaderExceptions { get {return _exceptions;} } [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); base.GetObjectData(info, context); info.AddValue("Types", _classes, typeof(Type[])); info.AddValue("Exceptions", _exceptions, typeof(Exception[])); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// // // ReflectionTypeLoadException is thrown when multiple TypeLoadExceptions may occur. // //[....] // Specifically, when you call Module.GetTypes() this causes multiple class loads to occur. // If there are failures, we continue to load classes and build an array of the successfully // loaded classes. We also build an array of the errors that occur. Then we throw this exception // which exposes both the array of classes and the array of TypeLoadExceptions. // // // // namespace System.Reflection { using System; using System.Runtime.Serialization; using System.Security.Permissions; using System.Diagnostics.Contracts; [Serializable] [System.Runtime.InteropServices.ComVisible(true)] public sealed class ReflectionTypeLoadException : SystemException, ISerializable { private Type[] _classes; private Exception[] _exceptions; // private constructor. This is not called. private ReflectionTypeLoadException() : base(Environment.GetResourceString("ReflectionTypeLoad_LoadFailed")) { SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } // private constructor. This is called from inside the runtime. private ReflectionTypeLoadException(String message) : base(message) { SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions) : base(null) { _classes = classes; _exceptions = exceptions; SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } public ReflectionTypeLoadException(Type[] classes, Exception[] exceptions, String message) : base(message) { _classes = classes; _exceptions = exceptions; SetErrorCode(__HResults.COR_E_REFLECTIONTYPELOAD); } internal ReflectionTypeLoadException(SerializationInfo info, StreamingContext context) : base (info, context) { _classes = (Type[])(info.GetValue("Types", typeof(Type[]))); _exceptions = (Exception[])(info.GetValue("Exceptions", typeof(Exception[]))); } public Type[] Types { get {return _classes;} } public Exception[] LoaderExceptions { get {return _exceptions;} } [System.Security.SecurityCritical] // auto-generated_required public override void GetObjectData(SerializationInfo info, StreamingContext context) { if (info==null) { throw new ArgumentNullException("info"); } Contract.EndContractBlock(); base.GetObjectData(info, context); info.AddValue("Types", _classes, typeof(Type[])); info.AddValue("Exceptions", _exceptions, typeof(Exception[])); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TdsParserStateObject.cs
- StringConverter.cs
- RegistryPermission.cs
- SelectionItemProviderWrapper.cs
- ProcessThread.cs
- ConfigurationValidatorAttribute.cs
- InternalRelationshipCollection.cs
- SoapInteropTypes.cs
- ItemMap.cs
- ErrorFormatterPage.cs
- GeometryGroup.cs
- BaseInfoTable.cs
- Directory.cs
- CryptoApi.cs
- ProviderConnectionPointCollection.cs
- WorkflowInstanceQuery.cs
- ConsumerConnectionPoint.cs
- XmlILIndex.cs
- AsyncDataRequest.cs
- ObjectResult.cs
- RemoteWebConfigurationHostStream.cs
- CapabilitiesState.cs
- ToolStripLabel.cs
- AnnotationComponentChooser.cs
- Size3DValueSerializer.cs
- OrderedDictionary.cs
- SequenceDesigner.xaml.cs
- CaretElement.cs
- MetafileHeaderWmf.cs
- coordinatorscratchpad.cs
- ExpandSegment.cs
- TriggerCollection.cs
- PaintEvent.cs
- DoubleCollectionConverter.cs
- GlyphShapingProperties.cs
- EventlogProvider.cs
- documentsequencetextcontainer.cs
- AudioStateChangedEventArgs.cs
- ServiceOperation.cs
- NativeCppClassAttribute.cs
- OleDbRowUpdatedEvent.cs
- ConstantSlot.cs
- XmlNotation.cs
- DisplayInformation.cs
- System.Data.OracleClient_BID.cs
- TraceSwitch.cs
- ConfigurationConverterBase.cs
- SoapCommonClasses.cs
- UpDownBase.cs
- ColumnProvider.cs
- IPEndPointCollection.cs
- CellPartitioner.cs
- Axis.cs
- AsmxEndpointPickerExtension.cs
- SafeRegistryHandle.cs
- SaveFileDialog.cs
- DataStorage.cs
- DbConnectionPoolCounters.cs
- XmlAnyAttributeAttribute.cs
- CodeStatementCollection.cs
- SymmetricCryptoHandle.cs
- _HeaderInfoTable.cs
- XPathSingletonIterator.cs
- FragmentNavigationEventArgs.cs
- TransactionScopeDesigner.cs
- RowToParametersTransformer.cs
- RegisteredArrayDeclaration.cs
- XmlSchemaAttributeGroup.cs
- ScriptManagerProxy.cs
- SimpleType.cs
- ErrorTableItemStyle.cs
- ByteAnimationBase.cs
- ReachBasicContext.cs
- XNodeValidator.cs
- MenuItem.cs
- StateMachineSubscriptionManager.cs
- TextWriterTraceListener.cs
- XpsImageSerializationService.cs
- WebEventTraceProvider.cs
- DataPointer.cs
- HijriCalendar.cs
- CqlParserHelpers.cs
- CodeNamespaceImport.cs
- WebRequestModulesSection.cs
- HttpCachePolicy.cs
- ObjectViewListener.cs
- ExplicitDiscriminatorMap.cs
- ConnectorSelectionGlyph.cs
- TerminatorSinks.cs
- StyleBamlTreeBuilder.cs
- RankException.cs
- DataGridViewComboBoxColumn.cs
- TraceContext.cs
- Soap.cs
- XmlReader.cs
- HttpPostedFile.cs
- SelectedDatesCollection.cs
- SearchForVirtualItemEventArgs.cs
- ConnectionStringSettings.cs
- SerialErrors.cs