Commit 0515a5f
* Restore concrete `FileRange` overloads on `FileContext`
#2306 widened the parameters of `FileContext.GetText` and `GetTextLines`
from the concrete `FileRange` class to the `IFileRange` interface so that
`$Context.CurrentFile.GetText($Context.SelectedRange)` would resolve (since
`SelectedRange` is typed as `IFileRange`). That fixed the script-side call,
but it dropped the old concrete-typed method slots from the assembly.
Downstream modules that compile against PSES, most notably
SeeminglyScience/EditorServicesCommandSuite, bind to the published metadata
at build time. A precompiled caller of the old `GetText(FileRange)` signature
would throw `MissingMethodException` at runtime even though it recompiles
cleanly, so this was a binary-breaking change.
Restore `GetText(FileRange)` and `GetTextLines(FileRange)` alongside the
`IFileRange` overloads. Each casts to `IFileRange` and delegates to the
widened implementation, so old binaries keep resolving and behavior is
unchanged. The added tests declare their argument as the concrete `FileRange`
so overload resolution actually exercises the compatibility shims.
Drafted by Copilot (Claude Opus 4.8).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Document public API binary-compatibility rules for Copilot
I missed that #2306 was binary-breaking until after it merged, so add a
"Public API & Binary Compatibility" section to the Copilot instructions to
catch the next one at review time.
The key context the agent was missing: the public types under
`Microsoft.PowerShell.EditorServices` aren't only reached through PowerShell
script. Downstream modules compile against the shipped assemblies, and
SeeminglyScience/EditorServicesCommandSuite in particular references the
extension API surface (`FileContext`, `IFileRange`, `ILspCurrentFileContext`,
`IEditorScriptFile`, ...) directly from C#. So widening or renaming an
existing `public` member is source-compatible at most but binary-breaking.
The section spells out the failure mode (`MissingMethodException`), the
fix (add an overload that delegates rather than editing the signature in
place), and the expectation to bind a regression test to the old concrete
signature.
Drafted by Copilot (Claude Opus 4.8).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 857b4ea commit 0515a5f
3 files changed
Lines changed: 85 additions & 0 deletions
File tree
- .github
- src/PowerShellEditorServices/Extensions
- test/PowerShellEditorServices.Test/Extensions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
95 | 125 | | |
96 | 126 | | |
97 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
115 | 127 | | |
116 | 128 | | |
117 | 129 | | |
| |||
125 | 137 | | |
126 | 138 | | |
127 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
128 | 152 | | |
129 | 153 | | |
130 | 154 | | |
| |||
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
67 | 98 | | |
68 | 99 | | |
0 commit comments