1616
1717#endregion
1818
19+ using System . Diagnostics . CodeAnalysis ;
1920using System . Reflection ;
2021using System . Runtime ;
2122using Common ;
@@ -31,6 +32,8 @@ public static void Main(string[] args)
3132 CreateHostBuilder ( args ) . Build ( ) . Run ( ) ;
3233 }
3334
35+ [ UnconditionalSuppressMessage ( "AotAnalysis" , "IL3050:RequiresDynamicCode" ,
36+ Justification = "DependencyInjection only used with safe types." ) ]
3437 public static IHostBuilder CreateHostBuilder ( string [ ] args )
3538 {
3639 var runtimeVersion = typeof ( object ) . GetTypeInfo ( ) . Assembly . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ? . InformationalVersion ?? "Unknown" ;
@@ -42,7 +45,7 @@ public static IHostBuilder CreateHostBuilder(string[] args)
4245 Console . WriteLine ( "----------------------------" ) ;
4346 Console . WriteLine ( $ "Args: { string . Join ( ' ' , args ) } ") ;
4447 Console . WriteLine ( $ "Current directory: { Directory . GetCurrentDirectory ( ) } ") ;
45- Console . WriteLine ( $ "WebHostBuilder loading from: { typeof ( WebHostBuilder ) . GetTypeInfo ( ) . Assembly . Location } ") ;
48+ Console . WriteLine ( $ "WebHostBuilder loading from: { AppContext . BaseDirectory } ") ;
4649 Console . WriteLine ( $ "NetCoreAppVersion: { runtimeVersion } ") ;
4750 Console . WriteLine ( $ "{ nameof ( GCSettings . IsServerGC ) } : { isServerGC } ") ;
4851 Console . WriteLine ( $ "{ nameof ( Environment . ProcessorCount ) } : { processorCount } ") ;
@@ -124,7 +127,7 @@ public static IHostBuilder CreateHostBuilder(string[] args)
124127
125128 private static void ConfigureListenOptions ( ListenOptions listenOptions , IConfigurationRoot config , System . Net . IPEndPoint endPoint )
126129 {
127- var basePath = Path . GetDirectoryName ( typeof ( Program ) . Assembly . Location ) ;
130+ var basePath = Path . GetDirectoryName ( AppContext . BaseDirectory ) ;
128131 var certPath = Path . Combine ( basePath ! , "Certs" , "server1.pfx" ) ;
129132
130133 var protocol = config [ "protocol" ] ?? "" ;
0 commit comments