File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/BenchmarkDotNet/Environments/Runtimes Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,16 @@ internal static bool TryGetVersion(out Version? version)
99
99
return true ;
100
100
}
101
101
102
- var systemPrivateCoreLib = FileVersionInfo . GetVersionInfo ( typeof ( object ) . Assembly . Location ) ;
103
- // systemPrivateCoreLib.Product*Part properties return 0 so we have to implement some ugly parsing.. .
104
- if ( TryGetVersionFromProductInfo ( systemPrivateCoreLib . ProductVersion , systemPrivateCoreLib . ProductName , out version ) )
102
+ string coreclrLocation = typeof ( object ) . GetTypeInfo ( ) . Assembly . Location ;
103
+ // Single-file publish has empty assembly location .
104
+ if ( ! string . IsNullOrEmpty ( coreclrLocation ) )
105
105
{
106
- return true ;
106
+ var systemPrivateCoreLib = FileVersionInfo . GetVersionInfo ( coreclrLocation ) ;
107
+ // systemPrivateCoreLib.Product*Part properties return 0 so we have to implement some ugly parsing...
108
+ if ( TryGetVersionFromProductInfo ( systemPrivateCoreLib . ProductVersion , systemPrivateCoreLib . ProductName , out version ) )
109
+ {
110
+ return true ;
111
+ }
107
112
}
108
113
109
114
// it's OK to use this method only after checking the previous ones
You can’t perform that action at this time.
0 commit comments