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
- odbcmetadatacollectionnames.cs
- CodeAttachEventStatement.cs
- MostlySingletonList.cs
- _SslStream.cs
- StickyNote.cs
- EmissiveMaterial.cs
- Clock.cs
- RootAction.cs
- SapiGrammar.cs
- MgmtConfigurationRecord.cs
- DateTimeStorage.cs
- FrameworkContextData.cs
- KerberosSecurityTokenAuthenticator.cs
- WizardDesigner.cs
- WebControlAdapter.cs
- XPathItem.cs
- ElementProxy.cs
- Zone.cs
- SafeNativeMethods.cs
- SQLInt16Storage.cs
- ResourceSet.cs
- RemotingConfiguration.cs
- UrlMappingCollection.cs
- UpdateCommandGenerator.cs
- XmlAttribute.cs
- ExpandedWrapper.cs
- AdRotator.cs
- sqlinternaltransaction.cs
- NavigateEvent.cs
- BufferModesCollection.cs
- EnumerableRowCollection.cs
- SafeArrayTypeMismatchException.cs
- CustomErrorCollection.cs
- CmsInterop.cs
- SynchronizedDispatch.cs
- StringUtil.cs
- HttpFileCollection.cs
- MultiView.cs
- TrackBarRenderer.cs
- OutputCacheProfile.cs
- NumericUpDownAcceleration.cs
- AttachedPropertyBrowsableForChildrenAttribute.cs
- DocumentViewerBase.cs
- Calendar.cs
- ConnectionStringsSection.cs
- MultipartContentParser.cs
- DataKey.cs
- MessagePropertyVariants.cs
- VirtualPathProvider.cs
- QueryStringConverter.cs
- XmlSchemaValidator.cs
- Trace.cs
- ChunkedMemoryStream.cs
- CodeSubDirectory.cs
- CombinedGeometry.cs
- UpdateTranslator.cs
- GridViewCommandEventArgs.cs
- IsolationInterop.cs
- SimpleWebHandlerParser.cs
- Profiler.cs
- ComponentChangingEvent.cs
- __TransparentProxy.cs
- RegisteredExpandoAttribute.cs
- SyndicationDeserializer.cs
- LinkTarget.cs
- ListBox.cs
- TextDecorationCollection.cs
- ObjectStorage.cs
- DuplexClientBase.cs
- BitStack.cs
- ListItemCollection.cs
- ScrollViewerAutomationPeer.cs
- CallInfo.cs
- DefaultValueAttribute.cs
- XmlQueryStaticData.cs
- Switch.cs
- AssemblyNameProxy.cs
- SqlXml.cs
- ConstraintCollection.cs
- sqlstateclientmanager.cs
- SafeRightsManagementHandle.cs
- ObjectCache.cs
- MenuItem.cs
- StrongName.cs
- BulletChrome.cs
- HandlerBase.cs
- SourceFileBuildProvider.cs
- ClickablePoint.cs
- TextServicesHost.cs
- PropertyChangedEventArgs.cs
- RawStylusInputCustomData.cs
- FormView.cs
- EmbeddedObject.cs
- FunctionParameter.cs
- FileUtil.cs
- QueryCorrelationInitializer.cs
- Brush.cs
- XmlAnyAttributeAttribute.cs
- BroadcastEventHelper.cs
- Translator.cs