@@ -26,8 +26,10 @@ internal static class NativeMethods
2626 private static NativeShutdownObject shutdownObject ;
2727#pragma warning restore 0414
2828
29+ #if ! NET46
2930 private static SmartSubtransportRegistration < ManagedHttpSmartSubtransport > httpSubtransportRegistration ;
3031 private static SmartSubtransportRegistration < ManagedHttpSmartSubtransport > httpsSubtransportRegistration ;
32+ #endif
3133
3234 static NativeMethods ( )
3335 {
@@ -45,7 +47,7 @@ static NativeMethods()
4547 string nativeLibraryPath = GetGlobalSettingsNativeLibraryPath ( ) ;
4648 if ( nativeLibraryPath != null )
4749 {
48- #if NETFRAMEWORK
50+ #if NET46
4951 if ( Platform . OperatingSystem == OperatingSystemType . Windows )
5052#else
5153 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
@@ -202,19 +204,22 @@ private static void InitializeNativeLibrary()
202204 shutdownObject = new NativeShutdownObject ( ) ;
203205 }
204206
207+ #if ! NET46
205208 // Configure the .NET HTTP(S) mechanism on the first initialization of the library in the current process.
206209 if ( initCounter == 1 )
207210 {
208211 httpSubtransportRegistration = GlobalSettings . RegisterDefaultSmartSubtransport < ManagedHttpSmartSubtransport > ( "http" ) ;
209212 httpsSubtransportRegistration = GlobalSettings . RegisterDefaultSmartSubtransport < ManagedHttpSmartSubtransport > ( "https" ) ;
210213 }
214+ #endif
211215 }
212216
213217 // Shutdown the native library in a finalizer.
214218 private sealed class NativeShutdownObject : CriticalFinalizerObject
215219 {
216220 ~ NativeShutdownObject ( )
217221 {
222+ #if ! NET46
218223 if ( httpSubtransportRegistration != null )
219224 {
220225 GlobalSettings . UnregisterDefaultSmartSubtransport ( httpSubtransportRegistration ) ;
@@ -224,6 +229,7 @@ private sealed class NativeShutdownObject : CriticalFinalizerObject
224229 {
225230 GlobalSettings . UnregisterDefaultSmartSubtransport ( httpsSubtransportRegistration ) ;
226231 }
232+ #endif
227233
228234 git_libgit2_shutdown ( ) ;
229235 }
0 commit comments