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
- DragSelectionMessageFilter.cs
- HostingEnvironment.cs
- StdValidatorsAndConverters.cs
- FileDialogCustomPlacesCollection.cs
- AddressHeaderCollectionElement.cs
- CodeComment.cs
- GraphicsPathIterator.cs
- storepermission.cs
- AppLevelCompilationSectionCache.cs
- contentDescriptor.cs
- PageParserFilter.cs
- OrCondition.cs
- TransformDescriptor.cs
- DataMisalignedException.cs
- SID.cs
- SelectionRange.cs
- CompatibleComparer.cs
- TextAutomationPeer.cs
- FlowchartDesigner.Helpers.cs
- BuildProviderAppliesToAttribute.cs
- COM2EnumConverter.cs
- Config.cs
- Misc.cs
- TextDecorations.cs
- ZipFileInfoCollection.cs
- WindowsListViewGroupHelper.cs
- TriggerActionCollection.cs
- FullTextState.cs
- HtmlInputReset.cs
- Emitter.cs
- ByteStorage.cs
- Parser.cs
- StandardOleMarshalObject.cs
- BindingMAnagerBase.cs
- Inline.cs
- XmlSchemaInferenceException.cs
- TileBrush.cs
- WebPartRestoreVerb.cs
- SqlTrackingWorkflowInstance.cs
- DictionaryTraceRecord.cs
- RSAPKCS1SignatureDeformatter.cs
- EmptyControlCollection.cs
- GlyphManager.cs
- EventWaitHandle.cs
- loginstatus.cs
- DragDrop.cs
- Wildcard.cs
- FrameworkPropertyMetadata.cs
- ContextMarshalException.cs
- IOThreadScheduler.cs
- RangeValuePatternIdentifiers.cs
- LexicalChunk.cs
- WMIInterop.cs
- ProxyWebPart.cs
- QueryRewriter.cs
- FormsAuthenticationConfiguration.cs
- CrossSiteScriptingValidation.cs
- HtmlContainerControl.cs
- StreamInfo.cs
- SimpleType.cs
- ReliableMessagingVersionConverter.cs
- SmiEventSink_DeferedProcessing.cs
- QualifiedCellIdBoolean.cs
- TemplateManager.cs
- Focus.cs
- FixedBufferAttribute.cs
- WebScriptServiceHostFactory.cs
- PolicyChain.cs
- ValueProviderWrapper.cs
- TargetConverter.cs
- HandlerBase.cs
- XslException.cs
- baseaxisquery.cs
- UnknownBitmapDecoder.cs
- Triplet.cs
- TabPanel.cs
- MsmqReceiveHelper.cs
- AsymmetricKeyExchangeDeformatter.cs
- AnnotationAuthorChangedEventArgs.cs
- Rect3DValueSerializer.cs
- RelationshipEndCollection.cs
- NumberFunctions.cs
- LocalTransaction.cs
- TransportContext.cs
- HiddenField.cs
- SchemaContext.cs
- DataViewManagerListItemTypeDescriptor.cs
- JoinCqlBlock.cs
- WorkflowInspectionServices.cs
- Set.cs
- ADMembershipProvider.cs
- LinqDataSourceContextEventArgs.cs
- MenuItemStyle.cs
- ContainerSelectorBehavior.cs
- NetMsmqBindingElement.cs
- DesignerListAdapter.cs
- SessionStateItemCollection.cs
- LoginName.cs
- RecognizedPhrase.cs
- TypeToken.cs