You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use ELF/COFF/PE/MACHO Header to get Executable Architecture (#2309)
* Use ELF/COFF/PE/MACHO Header to get Executable Architecture
We need to verify a user's install matches the architecture that the code application / extension wants to run under.
We used to do this with dotnet --info which is a fallback.
Now, we can also do this with dotnet --list-runtimes --arch when supported. However, checking if it is supported requires an extra process call which is slower than reading the file header.
Once we hit dotnet 11, we will know that --arch is supported so we can skip this work of reading the file header. For now, this will allow us to gain a perf boost in the cases where this works.
Documented in the code is how this logic works. Additionally, I've added test executables (real .net 9 ones) to show it works. Finally, I added the copyfiles module to copy the test assets into the dist folder, as otherwise they dont get copied.
* Update package lock to include copy file
in a separate commit so easy to revert /etc
* Fix merge conflict
* Fix typo
* Fix lint
* Fix tests
* Fix tests more
* Speed up test by mocking list sdks
* Fix other tests
* Fix comments
// This is deprecated but still needed to scan .NET 6 and below
35
36
process.env.DOTNET_MULTILEVEL_LOOKUP='0';// make it so --list-runtimes only finds the runtimes on that path: https://learn.microsoft.com/en-us/dotnet/core/compatibility/deployment/7.0/multilevel-lookup#reason-for-change
@@ -38,11 +39,11 @@ export class DotnetConditionValidator implements IDotnetConditionValidator
@@ -357,7 +358,7 @@ Please set the PATH to a dotnet host that matches the architecture ${requirement
357
358
version: parts[1],
358
359
directory: runtime.split(' ').slice(2).join(' ').slice(1,-1),// account for spaces in PATH, no space should appear before then and luckily path is last.
359
360
// the 2nd slice needs to remove the brackets from the path [path]
0 commit comments