Commit 3114f8e
Fix Type.IsVisible and Type.ContainsGenericParameters for function pointers (dotnet#122224)
- [x] Understand the issue: `Type.IsVisible` and
`Type.ContainsGenericParameters` don't handle function pointers
correctly
- [x] Modify `ContainsGenericParameters` in Type.Helpers.cs to check
function pointer return and parameter types
- [x] Modify `IsVisible` in Type.Helpers.cs to check function pointer
return and parameter types
- [x] Add tests for function pointer visibility with private types
- [x] Add tests for function pointer ContainsGenericParameters with
generic types
- [x] Build and test the changes
- [x] Run code review and address feedback
- [x] Run CodeQL checker
<!-- START COPILOT CODING AGENT SUFFIX -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Abstract implementations of Type.IsVisible and
Type.ContainsGenericParameters do not handle function
pointers</issue_title>
> <issue_description>### Description
>
> Abstract implementations of Type.IsVisible and
Type.ContainsGenericParameters do not handle function pointers
>
> ### Reproduction Steps
>
> ```
> unsafe
> {
> Console.WriteLine(typeof(delegate* <string>).IsVisible);
> Console.WriteLine(typeof(delegate* <PrivateType>).IsVisible);
> }
>
>
> class PrivateType { }
> ```
>
> ### Expected behavior
>
> `true false` with `dotnet run` (correct).
>
>
> ### Actual behavior
>
> `true true` with PublishAot=true
>
> ### Regression?
>
> _No response_
>
> ### Known Workarounds
>
> _No response_
>
> ### Configuration
>
> _No response_
>
> ### Other information
>
> _No response_</issue_description>
>
> <agent_instructions>Handle function pointers in these two methods in
Type.Helpers.cs. Make sure to add tests</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
- Fixes dotnet#122223
<!-- START COPILOT CODING AGENT TIPS -->
---
💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>1 parent 86dfeb9 commit 3114f8e
3 files changed
Lines changed: 145 additions & 2 deletions
File tree
- src/libraries
- Common/tests/System
- System.Private.CoreLib/src/System
- System.Runtime/tests/System.Runtime.Tests/System/Type
Lines changed: 36 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
192 | 218 | | |
193 | 219 | | |
194 | 220 | | |
| |||
270 | 296 | | |
271 | 297 | | |
272 | 298 | | |
273 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
274 | 302 | | |
275 | 303 | | |
276 | 304 | | |
| |||
283 | 311 | | |
284 | 312 | | |
285 | 313 | | |
286 | | - | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
287 | 320 | | |
288 | 321 | | |
289 | 322 | | |
| |||
299 | 332 | | |
300 | 333 | | |
301 | 334 | | |
| 335 | + | |
302 | 336 | | |
303 | 337 | | |
304 | 338 | | |
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
52 | 66 | | |
53 | 67 | | |
54 | 68 | | |
| |||
88 | 102 | | |
89 | 103 | | |
90 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
91 | 119 | | |
92 | 120 | | |
93 | 121 | | |
| |||
Lines changed: 81 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1509 | 1509 | | |
1510 | 1510 | | |
1511 | 1511 | | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
| 1518 | + | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
| 1530 | + | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
1512 | 1593 | | |
1513 | 1594 | | |
1514 | 1595 | | |
| |||
0 commit comments