/
NetworkInformationException.cs
71 lines (63 loc) · 2.45 KB
/
NetworkInformationException.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.ComponentModel;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Net.NetworkInformation
{
/// <devdoc>
/// <para>
/// Provides NetworkInformation exceptions to the application.
/// </para>
/// </devdoc>
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class NetworkInformationException : Win32Exception
{
/// <devdoc>
/// <para>
/// Creates a new instance of the <see cref='System.Net.NetworkInformation.NetworkInformationException'/> class with the default error code.
/// </para>
/// </devdoc>
public NetworkInformationException() : base(Marshal.GetLastPInvokeError())
{
}
/// <devdoc>
/// <para>
/// Creates a new instance of the <see cref='System.Net.NetworkInformation.NetworkInformationException'/> class with the specified error code.
/// </para>
/// </devdoc>
public NetworkInformationException(int errorCode) : base(errorCode)
{
}
#if NET8_0_OR_GREATER
[Obsolete(Obsoletions.LegacyFormatterImplMessage, DiagnosticId = Obsoletions.LegacyFormatterImplDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
[EditorBrowsable(EditorBrowsableState.Never)]
#endif
protected NetworkInformationException(SerializationInfo serializationInfo, StreamingContext streamingContext) : base(serializationInfo, streamingContext)
{
}
internal NetworkInformationException(SocketError socketError) : base((int)socketError)
{
}
internal NetworkInformationException(string message) : base(message)
{
}
internal NetworkInformationException(string message, Exception innerException) : base(message, innerException)
{
}
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
public override int ErrorCode
{
// The base class returns the HResult with this property.
// We need the Win32 error code, hence the override.
get
{
return NativeErrorCode;
}
}
}
}