Commit 617f9ee
Add
* Add `TypeName.Namespace` and tests.
* Add `TypeName.Unescape`.
* Update reference assembly.
* Remove file with duplicate `Unescape` method.
* Reduce allocations when calling `Namespace` across a type name hierachy.
* Fix nested types with namespaces.
* Add tests for `Unescape`.
* Update `GetNamespace` to fail if a nested type has a namespace.
* Remove support for nested types and escaped dots in namespaces.
* Remove support for escaped dots in `GetName`, and optimize it if the type is not nested.
* Simplify `Name` to avoid linear search of the full name in nested types.
* [mono] Do not treat nested type names as full names.
* Update algorithm to find namespace delimiter.
* Redirect all `Type.GetType` overloads in Mono through `TypeNameResolver`.
* Update tests to account for Mono using the managed type parser in `Type.GetType`.
* Disallow getting the namespace of non-simple nested type names.
* Ignore ambiguous match exceptions in non-extensible `Type.GetType` overloads.
This matches the behavior of CoreCLR and Native AOT.
* Use alternative strategy to provide a `(message, typeName)` overload in Mono, while still avoiding changes to the Mono runtime code.
---------
Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>TypeName APIs to simplify metadata lookup. (#111598)1 parent fe9e119 commit 617f9ee
File tree
15 files changed
+321
-111
lines changed- src
- coreclr
- System.Private.CoreLib/src/System/Reflection
- nativeaot/System.Private.CoreLib/src/System/Reflection
- libraries
- System.Private.CoreLib/src
- System/Reflection
- System.Reflection.Metadata
- ref
- src
- Resources
- System/Reflection/Metadata
- tests/Metadata
- System.Runtime/tests/System.Runtime.Tests/System/Type
- mono/System.Private.CoreLib/src/System
- Reflection
15 files changed
+321
-111
lines changedLines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| |||
282 | 282 | | |
283 | 283 | | |
284 | 284 | | |
285 | | - | |
| 285 | + | |
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
161 | | - | |
| 161 | + | |
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1489 | 1489 | | |
1490 | 1490 | | |
1491 | 1491 | | |
1492 | | - | |
1493 | | - | |
1494 | | - | |
1495 | 1492 | | |
1496 | 1493 | | |
1497 | 1494 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2439 | 2439 | | |
2440 | 2440 | | |
2441 | 2441 | | |
| 2442 | + | |
2442 | 2443 | | |
2443 | 2444 | | |
2444 | 2445 | | |
| |||
2451 | 2452 | | |
2452 | 2453 | | |
2453 | 2454 | | |
| 2455 | + | |
2454 | 2456 | | |
2455 | 2457 | | |
2456 | 2458 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
429 | 429 | | |
430 | 430 | | |
431 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
432 | 435 | | |
433 | 436 | | |
434 | 437 | | |
| |||
Lines changed: 90 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
| |||
229 | 230 | | |
230 | 231 | | |
231 | 232 | | |
| 233 | + | |
232 | 234 | | |
233 | 235 | | |
234 | 236 | | |
| |||
262 | 264 | | |
263 | 265 | | |
264 | 266 | | |
265 | | - | |
| 267 | + | |
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
272 | 274 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | 275 | | |
278 | 276 | | |
279 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
280 | 296 | | |
281 | 297 | | |
282 | 298 | | |
283 | 299 | | |
284 | 300 | | |
285 | 301 | | |
286 | 302 | | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
287 | 350 | | |
288 | 351 | | |
289 | 352 | | |
| |||
401 | 464 | | |
402 | 465 | | |
403 | 466 | | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
404 | 486 | | |
405 | 487 | | |
406 | 488 | | |
| |||
Lines changed: 56 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
106 | 106 | | |
107 | | - | |
108 | | - | |
109 | | - | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
112 | 118 | | |
113 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
114 | 123 | | |
115 | | - | |
| 124 | + | |
| 125 | + | |
116 | 126 | | |
117 | 127 | | |
118 | | - | |
| 128 | + | |
119 | 129 | | |
120 | | - | |
| 130 | + | |
121 | 131 | | |
122 | | - | |
123 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
124 | 138 | | |
125 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
126 | 142 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
132 | 151 | | |
133 | 152 | | |
134 | | - | |
| 153 | + | |
| 154 | + | |
135 | 155 | | |
136 | 156 | | |
137 | 157 | | |
| |||
350 | 370 | | |
351 | 371 | | |
352 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
353 | 379 | | |
354 | 380 | | |
355 | 381 | | |
| |||
411 | 437 | | |
412 | 438 | | |
413 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
414 | 451 | | |
415 | 452 | | |
416 | 453 | | |
| |||
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
| |||
0 commit comments