Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / clr / src / BCL / System / TypeInitializationException.cs / 1 / TypeInitializationException.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*==============================================================================
**
** Class: TypeInitializationException
**
**
** Purpose: The exception class to wrap exceptions thrown by
** a type's class initializer (.cctor). This is sufficiently
** distinct from a TypeLoadException, which means we couldn't
** find the type.
**
**
=============================================================================*/
using System;
using System.Runtime.Serialization;
using System.Globalization;
using System.Security.Permissions;
namespace System {
[Serializable()]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeInitializationException : SystemException {
private String _typeName;
// This exception is not creatable without specifying the
// inner exception.
private TypeInitializationException()
: base(Environment.GetResourceString("TypeInitialization_Default")) {
SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION);
}
// This is called from within the runtime. I believe this is necessary
// for Interop only, though it's not particularly useful.
private TypeInitializationException(String message) : base(message) {
SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION);
}
public TypeInitializationException(String fullTypeName, Exception innerException) : base(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("TypeInitialization_Type"), fullTypeName), innerException) {
_typeName = fullTypeName;
SetErrorCode(__HResults.COR_E_TYPEINITIALIZATION);
}
internal TypeInitializationException(SerializationInfo info, StreamingContext context) : base(info, context) {
_typeName = info.GetString("TypeName");
}
public String TypeName
{
get {
if (_typeName == null) {
return String.Empty;
}
return _typeName;
}
}
[SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
public override void GetObjectData(SerializationInfo info, StreamingContext context) {
base.GetObjectData(info, context);
info.AddValue("TypeName",TypeName,typeof(String));
}
}
}
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SoapSchemaImporter.cs
- SchemaImporterExtension.cs
- ScrollBar.cs
- MemoryMappedViewAccessor.cs
- GrammarBuilderDictation.cs
- ConfigurationPropertyCollection.cs
- TextShapeableCharacters.cs
- XamlWrapperReaders.cs
- XmlEntityReference.cs
- BitmapMetadata.cs
- XPathBinder.cs
- ByteAnimationUsingKeyFrames.cs
- ActivityCodeGenerator.cs
- WindowsRichEdit.cs
- ObjectIDGenerator.cs
- RemotingConfiguration.cs
- GeometryDrawing.cs
- Assert.cs
- ConfigurationLocationCollection.cs
- NaturalLanguageHyphenator.cs
- SettingsAttributeDictionary.cs
- CacheChildrenQuery.cs
- PngBitmapDecoder.cs
- WriteTimeStream.cs
- ImageListStreamer.cs
- XmlSchemaComplexType.cs
- ApplicationFileCodeDomTreeGenerator.cs
- TextBox.cs
- NegotiationTokenProvider.cs
- ThreadExceptionEvent.cs
- ConditionCollection.cs
- AbsoluteQuery.cs
- Message.cs
- LeftCellWrapper.cs
- Pair.cs
- ObjectListCommandCollection.cs
- HttpListenerResponse.cs
- DbQueryCommandTree.cs
- Graphics.cs
- XmlILAnnotation.cs
- ResourceManagerWrapper.cs
- SspiSecurityTokenParameters.cs
- StylusPointPropertyId.cs
- AxisAngleRotation3D.cs
- XmlIterators.cs
- MachineKeyConverter.cs
- DecimalConstantAttribute.cs
- DSASignatureDeformatter.cs
- ExternalFile.cs
- XmlWellformedWriter.cs
- LocalFileSettingsProvider.cs
- CertificateElement.cs
- PropertyMappingExceptionEventArgs.cs
- ExpandedWrapper.cs
- DateTimeSerializationSection.cs
- Graph.cs
- SQLResource.cs
- Base64Encoder.cs
- CollectionViewGroupInternal.cs
- ObjectCloneHelper.cs
- COM2FontConverter.cs
- BamlRecordWriter.cs
- QuaternionValueSerializer.cs
- FixedSOMTableCell.cs
- ControlValuePropertyAttribute.cs
- StringConcat.cs
- DataGridColumnStyleMappingNameEditor.cs
- ImageKeyConverter.cs
- Content.cs
- DataExpression.cs
- ToolStripOverflowButton.cs
- DropShadowEffect.cs
- HTTPNotFoundHandler.cs
- DeferredReference.cs
- ELinqQueryState.cs
- Literal.cs
- ExpandSegment.cs
- AssemblyName.cs
- HexParser.cs
- PanelContainerDesigner.cs
- CryptoConfig.cs
- ViewManager.cs
- OutputCacheSettings.cs
- QuinticEase.cs
- SourceLineInfo.cs
- InputScopeConverter.cs
- AuthenticationModulesSection.cs
- BinHexDecoder.cs
- TextDecoration.cs
- Quaternion.cs
- NativeMethods.cs
- EventMappingSettings.cs
- ImageCollectionCodeDomSerializer.cs
- ArrayConverter.cs
- MetadataCache.cs
- TabPanel.cs
- RC2CryptoServiceProvider.cs
- FormViewCommandEventArgs.cs
- SecurityPolicySection.cs
- OdbcParameter.cs