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
- RadioButtonAutomationPeer.cs
- StatusBarPanel.cs
- Decoder.cs
- StaticContext.cs
- GlyphingCache.cs
- ReferentialConstraintRoleElement.cs
- Workspace.cs
- D3DImage.cs
- DbConnectionPoolGroup.cs
- XmlImplementation.cs
- InterleavedZipPartStream.cs
- TransformProviderWrapper.cs
- X509CertificateClaimSet.cs
- StringFunctions.cs
- StrokeRenderer.cs
- DBSqlParserTable.cs
- LoginAutoFormat.cs
- NameScope.cs
- CodeTypeParameterCollection.cs
- DiffuseMaterial.cs
- ConsoleTraceListener.cs
- ProviderMetadata.cs
- CdpEqualityComparer.cs
- VariantWrapper.cs
- ConfigurationSectionGroupCollection.cs
- FormsAuthenticationCredentials.cs
- TempFiles.cs
- metadatamappinghashervisitor.cs
- TcpChannelFactory.cs
- MenuItemAutomationPeer.cs
- CommandDevice.cs
- CounterSampleCalculator.cs
- XmlILStorageConverter.cs
- _FtpControlStream.cs
- X509CertificateValidator.cs
- MapPathBasedVirtualPathProvider.cs
- UserNameSecurityTokenProvider.cs
- WsdlContractConversionContext.cs
- XPathDocumentBuilder.cs
- IgnoreFlushAndCloseStream.cs
- TemplateControlParser.cs
- BindingElementCollection.cs
- DiscoveryExceptionDictionary.cs
- ElementUtil.cs
- WebContext.cs
- Win32KeyboardDevice.cs
- PtsCache.cs
- SizeChangedInfo.cs
- DataListCommandEventArgs.cs
- Scene3D.cs
- OdbcReferenceCollection.cs
- LassoHelper.cs
- PackageDigitalSignatureManager.cs
- ParsedRoute.cs
- TemplateContent.cs
- PrefixHandle.cs
- InputReportEventArgs.cs
- InfoCardRSACryptoProvider.cs
- TextTreeUndo.cs
- WinFormsSecurity.cs
- StreamGeometry.cs
- HostVisual.cs
- EntityDataSourceReferenceGroup.cs
- VersionedStream.cs
- HashHelpers.cs
- EditorZone.cs
- SpecialNameAttribute.cs
- shaper.cs
- AssemblySettingAttributes.cs
- TextEndOfLine.cs
- StaticTextPointer.cs
- RC2CryptoServiceProvider.cs
- DataBinding.cs
- TemplateLookupAction.cs
- RegisteredDisposeScript.cs
- ApplicationTrust.cs
- HttpWebResponse.cs
- AbsoluteQuery.cs
- DelimitedListTraceListener.cs
- RequestResizeEvent.cs
- SplineKeyFrames.cs
- CopyCodeAction.cs
- Propagator.Evaluator.cs
- TransformedBitmap.cs
- InheritedPropertyDescriptor.cs
- HtmlDocument.cs
- Metafile.cs
- XmlAttribute.cs
- BinaryObjectWriter.cs
- RangeValidator.cs
- Timer.cs
- MiniMapControl.xaml.cs
- Nodes.cs
- FastPropertyAccessor.cs
- CapabilitiesState.cs
- sitestring.cs
- PrintSystemException.cs
- OdbcError.cs
- CngKeyBlobFormat.cs
- UnmanagedMemoryAccessor.cs