Commit 7f08b77
authored
[Java.Interop.Tools.Cecil]
Context: 7d42864
Context: dotnet/android#8571
While debugging dotnet/android#8571, I found that the usage
of `MemoryMappedFile` (from 7d42864) broke `.pdb` symbol loading.
This is OK, because we'll likely disable symbol loading anyway, but
we should at least address our bugs here for the future.
In order for the following code to load symbols:
var options = new ReaderParameters {
// …
};
AssemblyDefinition result = ModuleDefinition.ReadModule(viewStream, options)
.Assembly;
You would need the following in `ReaderParameters options`:
* `options.ReadSymbols=true`
* `options.SymbolStream` containing a valid `Stream` to the
`.pdb` file
To make this work, I had to:
* Create a `List<IDisposable>` for bookkeeping.
* When successful, we transfer ownership of the `MemoryMappedFile`
from the `List<IDisposable>` of `MemoryMappedViewStream` to the
`viewStreams` collection.
* When unsuccessful, we'd just dispose of the
`MemoryMappedViewStream`.
* If `options.ReadWrite==true`, we can just use `File.OpenRead()`
for symbols, versus `MemoryMappedViewStream`.
Other changes:
* Added tests to verify we can load a `.dll` and its symbols with
appropriate settings.
* Stop looking for `.mdb` files.
We no longer support these in .NET 6+.
* Removed unnecessary `$""` string interpolation.DirectoryAssemblyResolver symbol loads (#1176)1 parent 07c7300 commit 7f08b77
File tree
2 files changed
+112
-17
lines changed- src/Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil
- tests/Java.Interop.Tools.JavaCallableWrappers-Tests/Java.Interop.Tools.JavaCallableWrappers
2 files changed
+112
-17
lines changedLines changed: 59 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
42 | 43 | | |
43 | 44 | | |
44 | 45 | | |
| |||
149 | 150 | | |
150 | 151 | | |
151 | 152 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | 153 | | |
156 | 154 | | |
157 | 155 | | |
158 | 156 | | |
159 | 157 | | |
160 | 158 | | |
161 | 159 | | |
162 | | - | |
163 | 160 | | |
164 | 161 | | |
165 | 162 | | |
166 | | - | |
167 | 163 | | |
168 | 164 | | |
169 | 165 | | |
170 | 166 | | |
171 | 167 | | |
172 | 168 | | |
173 | 169 | | |
174 | | - | |
| 170 | + | |
175 | 171 | | |
176 | 172 | | |
| 173 | + | |
| 174 | + | |
177 | 175 | | |
178 | 176 | | |
179 | 177 | | |
180 | 178 | | |
181 | 179 | | |
182 | 180 | | |
183 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
187 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
188 | 191 | | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
194 | 195 | | |
| 196 | + | |
195 | 197 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
201 | 207 | | |
202 | 208 | | |
203 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
204 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
205 | 247 | | |
206 | 248 | | |
207 | 249 | | |
| |||
Lines changed: 53 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments