< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 8
Coverable lines: 8
Total lines: 30
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 4
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)0%220%
Finalize()0%220%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/Common/src/System/Net/DebugSafeHandleZeroOrMinusOneIsInvalid.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using Microsoft.Win32.SafeHandles;
 5
 6namespace System.Net
 7{
 8#if DEBUG
 9    //
 10    // This is a helper class for debugging GC-ed handles that we define.
 11    // As a general rule normal code path should always destroy handles explicitly
 12    //
 13    internal abstract class DebugSafeHandleZeroOrMinusOneIsInvalid : SafeHandleZeroOrMinusOneIsInvalid
 14    {
 15        private readonly string _trace;
 16
 017        protected DebugSafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base(ownsHandle)
 018        {
 019            _trace = "WARNING! GC-ed  >>" + this.GetType().FullName + "<< (should be explicitly closed) \r\n";
 020            if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, "Creating SafeHandle");
 021        }
 22
 23        ~DebugSafeHandleZeroOrMinusOneIsInvalid()
 024        {
 025            if (NetEventSource.Log.IsEnabled()) NetEventSource.Info(this, _trace);
 026        }
 27    }
 28#endif // DEBUG
 29}
 30

Methods/Properties

.ctor(System.Boolean)
Finalize()