Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / SMDiagnostics / System / ServiceModel / Diagnostics / Utility.cs / 1305376 / Utility.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Diagnostics { using System.Runtime; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Diagnostics; using System.Threading; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Diagnostics.CodeAnalysis; class Utility { ExceptionUtility exceptionUtility; [Obsolete("For SMDiagnostics.dll use only. Call DiagnosticUtility.Utility instead")] internal Utility(ExceptionUtility exceptionUtility) { this.exceptionUtility = exceptionUtility; } // Call this when a p/invoke with an 'out SafeHandle' parameter returns an error. This will safely clean up the handle. internal static void CloseInvalidOutSafeHandle(SafeHandle handle) { // Workaround for 64-bit CLR bug VSWhidbey 546830 - sometimes invalid SafeHandles come back null. if (handle != null) { #pragma warning disable 618 AssertUtility.DebugAssert(handle.IsInvalid, "CloseInvalidOutSafeHandle called with a valid handle!"); #pragma warning restore 618 // Calls SuppressFinalize. handle.SetHandleAsInvalid(); } } // Copy of the above for CriticalHandles. internal static void CloseInvalidOutCriticalHandle(CriticalHandle handle) { if (handle != null) { #pragma warning disable 618 AssertUtility.DebugAssert(handle.IsInvalid, "CloseInvalidOutCriticalHandle called with a valid handle!"); #pragma warning restore 618 handle.SetHandleAsInvalid(); } } internal Guid CreateGuid(string guidString) { return Fx.CreateGuid(guidString); } internal bool TryCreateGuid(string guidString, out Guid result) { return Fx.TryCreateGuid(guidString, out result); } internal byte[] AllocateByteArray(int size) { return Fx.AllocateByteArray(size); } internal char[] AllocateCharArray(int size) { return Fx.AllocateCharArray(size); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.ServiceModel.Diagnostics { using System.Runtime; using System.Runtime.CompilerServices; using System.Runtime.ConstrainedExecution; using System.Diagnostics; using System.Threading; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Diagnostics.CodeAnalysis; class Utility { ExceptionUtility exceptionUtility; [Obsolete("For SMDiagnostics.dll use only. Call DiagnosticUtility.Utility instead")] internal Utility(ExceptionUtility exceptionUtility) { this.exceptionUtility = exceptionUtility; } // Call this when a p/invoke with an 'out SafeHandle' parameter returns an error. This will safely clean up the handle. internal static void CloseInvalidOutSafeHandle(SafeHandle handle) { // Workaround for 64-bit CLR bug VSWhidbey 546830 - sometimes invalid SafeHandles come back null. if (handle != null) { #pragma warning disable 618 AssertUtility.DebugAssert(handle.IsInvalid, "CloseInvalidOutSafeHandle called with a valid handle!"); #pragma warning restore 618 // Calls SuppressFinalize. handle.SetHandleAsInvalid(); } } // Copy of the above for CriticalHandles. internal static void CloseInvalidOutCriticalHandle(CriticalHandle handle) { if (handle != null) { #pragma warning disable 618 AssertUtility.DebugAssert(handle.IsInvalid, "CloseInvalidOutCriticalHandle called with a valid handle!"); #pragma warning restore 618 handle.SetHandleAsInvalid(); } } internal Guid CreateGuid(string guidString) { return Fx.CreateGuid(guidString); } internal bool TryCreateGuid(string guidString, out Guid result) { return Fx.TryCreateGuid(guidString, out result); } internal byte[] AllocateByteArray(int size) { return Fx.AllocateByteArray(size); } internal char[] AllocateCharArray(int size) { return Fx.AllocateCharArray(size); } } } // 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
- DataListComponentEditor.cs
- TrustLevel.cs
- CharacterString.cs
- ContextInformation.cs
- MsmqIntegrationChannelListener.cs
- SoundPlayerAction.cs
- ToolTip.cs
- LineBreakRecord.cs
- ApplicationContext.cs
- FixedSOMTextRun.cs
- MobileSysDescriptionAttribute.cs
- XmlException.cs
- InvalidCastException.cs
- UnmanagedMarshal.cs
- ThousandthOfEmRealDoubles.cs
- isolationinterop.cs
- BaseParser.cs
- LookupBindingPropertiesAttribute.cs
- TypeElementCollection.cs
- PropertyGridView.cs
- MouseButtonEventArgs.cs
- RectangleF.cs
- VisualBrush.cs
- UseLicense.cs
- Version.cs
- AuthenticationException.cs
- DrawingContextWalker.cs
- StringOutput.cs
- TemplatedEditableDesignerRegion.cs
- Psha1DerivedKeyGeneratorHelper.cs
- EmbeddedObject.cs
- FormViewDeleteEventArgs.cs
- FrameworkContextData.cs
- MemberPath.cs
- HttpConfigurationSystem.cs
- TextOutput.cs
- NavigationEventArgs.cs
- SelectingProviderEventArgs.cs
- ControlBuilderAttribute.cs
- UpdatePanel.cs
- XappLauncher.cs
- Propagator.cs
- ImageFormat.cs
- DataSourceXmlSerializer.cs
- SortAction.cs
- FlagsAttribute.cs
- FrameworkElementFactory.cs
- ArraySortHelper.cs
- KeyBinding.cs
- Debug.cs
- ConditionalExpression.cs
- XmlSchemaExporter.cs
- HttpsHostedTransportConfiguration.cs
- HostingEnvironmentSection.cs
- DatatypeImplementation.cs
- Codec.cs
- StrokeNodeData.cs
- ClientRoleProvider.cs
- PageThemeBuildProvider.cs
- SelectionRange.cs
- PageStatePersister.cs
- CodeCatchClauseCollection.cs
- BaseComponentEditor.cs
- RijndaelManagedTransform.cs
- TemplateKey.cs
- bidPrivateBase.cs
- WebPartUtil.cs
- RegexMatchCollection.cs
- updateconfighost.cs
- DataSourceSelectArguments.cs
- StoryFragments.cs
- XmlSerializationGeneratedCode.cs
- XmlToDatasetMap.cs
- FileLevelControlBuilderAttribute.cs
- PrintController.cs
- XAMLParseException.cs
- ToolboxDataAttribute.cs
- ConstraintManager.cs
- CompletedAsyncResult.cs
- DbMetaDataColumnNames.cs
- CurrentChangedEventManager.cs
- ConfigXmlWhitespace.cs
- OleDbFactory.cs
- ValidatedControlConverter.cs
- NativeMethods.cs
- StateDesigner.LayoutSelectionGlyph.cs
- ConnectionManagementElement.cs
- Soap.cs
- DynamicRendererThreadManager.cs
- SchemaTableOptionalColumn.cs
- CommandEventArgs.cs
- XmlSchemaImporter.cs
- Timeline.cs
- TokenizerHelper.cs
- OleAutBinder.cs
- UnionCqlBlock.cs
- DynamicValidatorEventArgs.cs
- KnownIds.cs
- ArraySubsetEnumerator.cs
- HwndSource.cs