Commit d696d69
committed
Fix NullReferenceException when binding to Dictionary<Enum, object> with x:DataType
Fixes #13856
## Problem
Using with a binding to like caused a NullReferenceException at compile time in XamlC.
## Solution
- **XamlC (SetPropertiesVisitor.cs)**: Added support for finding indexers with enum parameter types and emitting enum constant values via IL
- **SourceGen (CompiledBindingMarkup.cs)**: Added support for enum indexer parameter types in the binding path parser
## Changes
- Added enum indexer detection in XamlC's property digger
- Updated type validation to allow enum indexer types
- Added code to emit enum constant values as IL instructions
- Added enum indexer support in SourceGen's TryParsePath method
- Fixed pre-existing test failure in Maui32879Tests (unrelated pragma warning directive)
## Tests
- Added Maui13856.xaml unit test for XamlC compilation
- Added Maui13856Tests.cs for SourceGen validation1 parent 34a9faa commit d696d69
File tree
6 files changed
+191
-6
lines changed- src/Controls
- src
- Build.Tasks
- SourceGen
- tests
- SourceGen.UnitTests
- Xaml.UnitTests/Issues
6 files changed
+191
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
720 | 720 | | |
721 | 721 | | |
722 | 722 | | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
723 | 729 | | |
724 | 730 | | |
725 | 731 | | |
726 | 732 | | |
727 | 733 | | |
728 | | - | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
729 | 738 | | |
730 | 739 | | |
731 | 740 | | |
| |||
743 | 752 | | |
744 | 753 | | |
745 | 754 | | |
746 | | - | |
| 755 | + | |
747 | 756 | | |
748 | 757 | | |
749 | 758 | | |
| |||
781 | 790 | | |
782 | 791 | | |
783 | 792 | | |
784 | | - | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
785 | 812 | | |
786 | 813 | | |
787 | 814 | | |
| |||
860 | 887 | | |
861 | 888 | | |
862 | 889 | | |
863 | | - | |
| 890 | + | |
864 | 891 | | |
865 | 892 | | |
866 | 893 | | |
| |||
950 | 977 | | |
951 | 978 | | |
952 | 979 | | |
953 | | - | |
| 980 | + | |
954 | 981 | | |
955 | 982 | | |
956 | 983 | | |
| |||
1076 | 1103 | | |
1077 | 1104 | | |
1078 | 1105 | | |
1079 | | - | |
| 1106 | + | |
1080 | 1107 | | |
1081 | 1108 | | |
1082 | 1109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
381 | 390 | | |
382 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
383 | 405 | | |
384 | 406 | | |
385 | 407 | | |
| |||
| 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 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 39 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 | + | |
0 commit comments