1
- #if ! UNIX
2
-
3
1
using System ;
4
2
using System . Collections . Generic ;
5
3
using System . Collections . ObjectModel ;
@@ -66,15 +64,7 @@ protected override void ProcessRecord()
66
64
{
67
65
WriteObject ( TimeZoneInfo . FindSystemTimeZoneById ( tzid ) ) ;
68
66
}
69
- #if CORECLR
70
- // TimeZoneNotFoundException is thrown by TimeZoneInfo, but not
71
- // publicly visible (so can't be caught), so for now we're catching
72
- // the parent exception time. This should be removed once the more
73
- // specific exception is available.
74
- catch ( Exception e )
75
- #else
76
67
catch ( TimeZoneNotFoundException e )
77
- #endif
78
68
{
79
69
WriteError ( new ErrorRecord ( e , TimeZoneHelper . TimeZoneNotFoundError ,
80
70
ErrorCategory . InvalidArgument , "Id" ) ) ;
@@ -103,14 +93,8 @@ protected override void ProcessRecord()
103
93
{
104
94
string message = string . Format ( CultureInfo . InvariantCulture ,
105
95
TimeZoneResources . TimeZoneNameNotFound , tzname ) ;
106
- #if CORECLR
107
- // Because .NET Core does not currently expose the TimeZoneNotFoundException
108
- // we need to throw the more generic parent exception class for the time being.
109
- // This should be removed once the correct exception class is available.
110
- Exception e = new Exception ( message ) ;
111
- #else
96
+
112
97
Exception e = new TimeZoneNotFoundException ( message ) ;
113
- #endif
114
98
WriteError ( new ErrorRecord ( e , TimeZoneHelper . TimeZoneNotFoundError ,
115
99
ErrorCategory . InvalidArgument , "Name" ) ) ;
116
100
}
@@ -125,6 +109,7 @@ protected override void ProcessRecord()
125
109
}
126
110
}
127
111
112
+ #if ! UNIX
128
113
129
114
/// <summary>
130
115
/// A cmdlet to set the system's local time zone.
@@ -804,7 +789,7 @@ public struct TOKEN_PRIVILEGES
804
789
#endregion Win32 interop helper
805
790
}
806
791
807
-
792
+ #endif
808
793
/// <summary>
809
794
/// static Helper class for working with system time zones.
810
795
/// </summary>
@@ -862,5 +847,3 @@ internal static TimeZoneInfo[] LookupSystemTimeZoneInfoByName(string name)
862
847
}
863
848
}
864
849
}
865
-
866
- #endif
0 commit comments