Commit 01024bb
committed
[xabt] fix incremental design-time builds (#10564)
Fixes: #10528
Fixes: #10563
There is a report in .NET 10 of *something* going wrong with
incremental builds (and possibly design-time builds)...
The app crashes with an error such as:
android.content.res.Resources$NotFoundException: String resource ID #0x7f1000be at
android.content.res.Resources.getText(Resources.java:466) at android.content.Context.getText(Context.java:933) at
androidx.appcompat.widget.Toolbar.setNavigationContentDescription(Toolbar.java:1001) at
crc64e02730b4d0e10e64.CustomShellRenderer_SectionRenderer.n_onCreateView(Native Method) at
crc64e02730b4d0e10e64.CustomShellRenderer_SectionRenderer.onCreateView(CustomShellRenderer_SectionRenderer.java:36) ...
Where the resource ID is invalid.
After some debugging, after watching the video:
* #10528 (comment)
I was able to reproduce the issue, when I did:
1. Open emulator
2. Open project in VS
3. Ctrl+F5 (see app running)
4. Close VS (make sure emulator stays open)
5. Reopen VS
6. Ctrl+F5 again
7. App crashes
Reviewing builds logs, I saw this oddity on the design-time build on
step 5:
Target _GenerateRtxt
Building target "_GenerateRtxt" completely.
Input file "Bug.Dependency.csproj" does not exist.
That is a referenced project file, it definitely should exist!
However, I noticed the path is wrong:
Target _CollectProjectReferenceResources
Task MSBuild
OutputItems
LibraryResourceDirectories
D:\src\dotnet-android-bug-10528\src\Bug.Dependency\Resources
StampFile = Bug.Dependency.csproj
`%(StampFile)` is a relative path, which can be fixed via:
StampFile="$(MSBuildProjectFile)"
StampFile="$(MSBuildProjectFullPath)"
This problem was introduced in .NET 10 via:
* 9ed1469
The target also uses `$(MSBuildProjectDirectory)`, which is a full path,
so it is ok. See:
* https://learn.microsoft.com/visualstudio/msbuild/msbuild-reserved-and-well-known-properties
I was also able to reproduce this issue by adding a class library to
the existing `BuildInDesignTimeMode()` test.1 parent 38cdcbe commit 01024bb
File tree
2 files changed
+36
-6
lines changed- src/Xamarin.Android.Build.Tasks
- MSBuild/Xamarin/Android
- Tests/Xamarin.Android.Build.Tests
2 files changed
+36
-6
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
Lines changed: 35 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
789 | 805 | | |
| 806 | + | |
790 | 807 | | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
791 | 816 | | |
792 | 817 | | |
793 | 818 | | |
794 | | - | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
795 | 822 | | |
796 | 823 | | |
797 | | - | |
798 | | - | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
799 | 829 | | |
800 | 830 | | |
801 | 831 | | |
802 | 832 | | |
803 | 833 | | |
804 | 834 | | |
805 | | - | |
806 | | - | |
| 835 | + | |
| 836 | + | |
807 | 837 | | |
808 | 838 | | |
809 | 839 | | |
| |||
0 commit comments