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
- ToolStripSettings.cs
- DataObjectMethodAttribute.cs
- WasAdminWrapper.cs
- CodeArrayCreateExpression.cs
- RepeaterCommandEventArgs.cs
- MutexSecurity.cs
- FixedDSBuilder.cs
- HttpApplicationFactory.cs
- SplitterPanel.cs
- DeflateInput.cs
- ServerType.cs
- EventMap.cs
- FixedTextPointer.cs
- SystemColors.cs
- NamedPermissionSet.cs
- DSASignatureFormatter.cs
- Cursors.cs
- CriticalExceptions.cs
- ToolStripRendererSwitcher.cs
- CrossSiteScriptingValidation.cs
- BufferedGraphics.cs
- ConstraintStruct.cs
- SamlNameIdentifierClaimResource.cs
- Int16KeyFrameCollection.cs
- ParentQuery.cs
- CompensationExtension.cs
- Blend.cs
- coordinatorfactory.cs
- X509UI.cs
- WinInetCache.cs
- ClientScriptItem.cs
- Graph.cs
- HttpBrowserCapabilitiesWrapper.cs
- ResXBuildProvider.cs
- XPathScanner.cs
- PagerSettings.cs
- ToolStripSplitButton.cs
- SupportsEventValidationAttribute.cs
- X509Certificate.cs
- PermissionAttributes.cs
- cookiecollection.cs
- XMLDiffLoader.cs
- WebPartChrome.cs
- FontFamilyIdentifier.cs
- UpdateRecord.cs
- MultiPageTextView.cs
- XmlEncodedRawTextWriter.cs
- ExceptionUtil.cs
- XamlTypeMapper.cs
- SecureUICommand.cs
- SpStreamWrapper.cs
- ProgressiveCrcCalculatingStream.cs
- TextTabProperties.cs
- EmissiveMaterial.cs
- EditorZoneBase.cs
- WebPartCancelEventArgs.cs
- CommandArguments.cs
- SerializationInfo.cs
- ContextInformation.cs
- CrossSiteScriptingValidation.cs
- WebPartHelpVerb.cs
- ClusterRegistryConfigurationProvider.cs
- ImportContext.cs
- CloseSequenceResponse.cs
- ReadOnlyHierarchicalDataSourceView.cs
- ConfigurationStrings.cs
- ContractMapping.cs
- FileLoadException.cs
- ApplicationServicesHostFactory.cs
- URLIdentityPermission.cs
- Wildcard.cs
- Point3D.cs
- ClearTypeHintValidation.cs
- ImageBrush.cs
- PageFunction.cs
- ZipIOExtraFieldElement.cs
- WSFederationHttpSecurityMode.cs
- EncryptedReference.cs
- HealthMonitoringSectionHelper.cs
- MarkupExtensionReturnTypeAttribute.cs
- SpecularMaterial.cs
- CachedBitmap.cs
- WebPartConnectionsCancelVerb.cs
- InputBindingCollection.cs
- TdsEnums.cs
- XPathMultyIterator.cs
- DiscoveryInnerClientAdhocCD1.cs
- WorkflowMarkupSerializerMapping.cs
- RectAnimationUsingKeyFrames.cs
- InternalsVisibleToAttribute.cs
- SafeNativeMethods.cs
- FilterableAttribute.cs
- Vector3DCollection.cs
- BufferedStream2.cs
- ParentQuery.cs
- basecomparevalidator.cs
- SafeNativeMethods.cs
- FormsAuthenticationUser.cs
- XmlNodeReader.cs
- SecurityResources.cs