Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / XamlBuildTask / XamlFxTrace.cs / 1305376 / XamlFxTrace.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Xaml { using System; using System.Runtime; using System.Reflection; using System.Threading; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Diagnostics.CodeAnalysis; static partial class FxTrace { const string baseEventSourceName = "System.Xaml"; static string eventSourceName; static ExceptionTrace exceptionTrace; public static ExceptionTrace Exception { get { if (exceptionTrace == null) { // don't need a lock here since a true singleton is not required exceptionTrace = new ExceptionTrace(EventSourceName); } return exceptionTrace; } } static string EventSourceName { get { if (eventSourceName == null) { object[] fileVersionList = typeof(FxTrace).Assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false); if (fileVersionList != null && fileVersionList.Length > 0 && fileVersionList[0] is AssemblyFileVersionAttribute) { eventSourceName = string.Concat(baseEventSourceName, " ", ((AssemblyFileVersionAttribute)fileVersionList[0]).Version); } else { eventSourceName = baseEventSourceName; } } return eventSourceName; } } // This never returns. The Exception return type lets you write 'throw FailFast()' which tells the compiler/tools that // execution stops. // This method is static on a beforefieldinit class. As long as it's built into the calling assembly and that assembly is // NGEN'd, it's very unlikely for the call itself to fail. [MethodImpl(MethodImplOptions.NoInlining)] [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "This template is shared across all assemblies, some of which use this accessor.")] public static Exception FailFast(string message) { // The catch is here to force the finally to run, as finallys don't run until the stack walk gets to a catch. // The catch makes sure that the finally will run before the stack-walk leaves the frame, but the code inside is impossible to reach. try { try { FxTrace.Exception.TraceFailFast(message); } finally { Environment.FailFast(message); } } catch { throw; } return null; // we'll never get here since we've just fail-fasted } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.Xaml { using System; using System.Runtime; using System.Reflection; using System.Threading; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Diagnostics.CodeAnalysis; static partial class FxTrace { const string baseEventSourceName = "System.Xaml"; static string eventSourceName; static ExceptionTrace exceptionTrace; public static ExceptionTrace Exception { get { if (exceptionTrace == null) { // don't need a lock here since a true singleton is not required exceptionTrace = new ExceptionTrace(EventSourceName); } return exceptionTrace; } } static string EventSourceName { get { if (eventSourceName == null) { object[] fileVersionList = typeof(FxTrace).Assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false); if (fileVersionList != null && fileVersionList.Length > 0 && fileVersionList[0] is AssemblyFileVersionAttribute) { eventSourceName = string.Concat(baseEventSourceName, " ", ((AssemblyFileVersionAttribute)fileVersionList[0]).Version); } else { eventSourceName = baseEventSourceName; } } return eventSourceName; } } // This never returns. The Exception return type lets you write 'throw FailFast()' which tells the compiler/tools that // execution stops. // This method is static on a beforefieldinit class. As long as it's built into the calling assembly and that assembly is // NGEN'd, it's very unlikely for the call itself to fail. [MethodImpl(MethodImplOptions.NoInlining)] [SuppressMessage(FxCop.Category.Performance, FxCop.Rule.AvoidUncalledPrivateCode, Justification = "This template is shared across all assemblies, some of which use this accessor.")] public static Exception FailFast(string message) { // The catch is here to force the finally to run, as finallys don't run until the stack walk gets to a catch. // The catch makes sure that the finally will run before the stack-walk leaves the frame, but the code inside is impossible to reach. try { try { FxTrace.Exception.TraceFailFast(message); } finally { Environment.FailFast(message); } } catch { throw; } return null; // we'll never get here since we've just fail-fasted } } } // 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
- ForAllOperator.cs
- ProxyGenerationError.cs
- BulletDecorator.cs
- ObjectManager.cs
- XmlStringTable.cs
- SafeCryptContextHandle.cs
- ToolStripItemTextRenderEventArgs.cs
- AssertFilter.cs
- UserControl.cs
- WebPartZoneBase.cs
- XmlCharCheckingReader.cs
- QuotedStringWriteStateInfo.cs
- ToolStripDropDownMenu.cs
- ManifestResourceInfo.cs
- InvokePattern.cs
- ColumnWidthChangedEvent.cs
- UpdateManifestForBrowserApplication.cs
- ResourcePart.cs
- NetworkInterface.cs
- WebPartDisplayMode.cs
- RtType.cs
- Size.cs
- RadialGradientBrush.cs
- Rights.cs
- querybuilder.cs
- Link.cs
- XmlAttribute.cs
- PeerPresenceInfo.cs
- DataGridViewCellCancelEventArgs.cs
- RefType.cs
- AutoScrollHelper.cs
- EncoderNLS.cs
- XmlResolver.cs
- XmlILConstructAnalyzer.cs
- XamlTypeMapper.cs
- _UncName.cs
- CodeGotoStatement.cs
- FlowDocumentView.cs
- ContainerParaClient.cs
- _LocalDataStoreMgr.cs
- DesignerSerializationVisibilityAttribute.cs
- ObjectItemCollection.cs
- SoapEnumAttribute.cs
- WinInetCache.cs
- WorkingDirectoryEditor.cs
- AsnEncodedData.cs
- RegexCaptureCollection.cs
- StrokeSerializer.cs
- SkinIDTypeConverter.cs
- ResourceExpressionBuilder.cs
- EntityProviderFactory.cs
- ZoneIdentityPermission.cs
- Nodes.cs
- XmlSchemaAttributeGroupRef.cs
- WebConfigurationHostFileChange.cs
- FrameAutomationPeer.cs
- CroppedBitmap.cs
- ContextMenuAutomationPeer.cs
- LogStream.cs
- ByteAnimationUsingKeyFrames.cs
- ToolStripItemRenderEventArgs.cs
- PageRanges.cs
- DataStorage.cs
- DispatcherProcessingDisabled.cs
- DataGridToolTip.cs
- SamlNameIdentifierClaimResource.cs
- RowToFieldTransformer.cs
- BrowsableAttribute.cs
- RegexWorker.cs
- PropertyIDSet.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- QuadraticEase.cs
- SettingsProviderCollection.cs
- FixedLineResult.cs
- GenericIdentity.cs
- FixedSOMPage.cs
- RegexStringValidator.cs
- CompModSwitches.cs
- SystemGatewayIPAddressInformation.cs
- QueryExecutionOption.cs
- PrivateFontCollection.cs
- KeyPullup.cs
- BitmapEffectInput.cs
- SetterBase.cs
- ErrorTolerantObjectWriter.cs
- RefType.cs
- XmlNodeComparer.cs
- EncodingNLS.cs
- ButtonBase.cs
- ValueConversionAttribute.cs
- HiddenField.cs
- IdentityNotMappedException.cs
- IssuanceLicense.cs
- WinEventHandler.cs
- HttpVersion.cs
- JsonEnumDataContract.cs
- ApplicationSecurityInfo.cs
- HttpListenerResponse.cs
- ReflectionServiceProvider.cs
- TreeView.cs