Commit 3b1d1aa
committed
review: harden IsInstalled() with assembly version checks
Address PR review: file-existence alone treats a stale v4 of
System.Runtime.CompilerServices.Unsafe (or any other downgraded plugin) as
"installed" and silently masks the bootstrap failure this PR is meant to fix.
Read each on-disk DLL's manifest via AssemblyName.GetAssemblyName(...).Version
and compare to the NuGet entry's declared version; if the file is older than
declared or its manifest can't be read, return false so Install() rewrites it.
Applied uniformly to all entries (defense-in-depth, per the optional suggestion
in the review).
Notes:
- System.Version comparison handles "6.0.0" (Revision=-1) vs "6.0.0.0"
(Revision=0) correctly: the higher-revision actual passes; a stale v4 fails.
- AssemblyName.GetAssemblyName only reads the manifest, no assembly load into
the AppDomain, so this is cheap and side-effect-free.
- Validated locally: with the v6 DLL in Plugins/Roslyn/, IsInstalled returns
true; manually swapping in a v4 placeholder causes it to return false and
Install() proceeds.1 parent f116493 commit 3b1d1aa
1 file changed
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | | - | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
33 | 55 | | |
34 | 56 | | |
35 | 57 | | |
| |||
0 commit comments