CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 22:22:08 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-repository-download: git clone https://github.com/dotnet/maui.git
etag: W/"f26c8649db0a128e0f0c51f3d7ac6f8f"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=I45boknCDt8tgvJSkvLCmVWVkN34%2FsAJOyLbuhnXQkTL3JJcOD%2BM5UJMBsgkYmpO27%2Fjp4kfJ5M%2F89gqZLVtpy1gfSQ64udlEE5W1EeGACCNluKZ7UudNQ%2F%2FTOChl32Q9xuj3Rz343gpKnxjys7ms%2BY%2BMoedNFJZxpS6kbCQROk%2FTh0ocSMLvzDpBTGGOT6EgASalcqUasNl2ArAcNRWTCjEeqc0LwiHYXSW8Gs1Xo8mzyi5nNsFLNVhnrAn9fRuYr%2FBnT594vvoaI%2F6mUY83g%3D%3D--oboOW4HMhwgJj2W5--JDoPB7%2F7j0af7O6NjU4VDA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.315752223.1753654927; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 22:22:07 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 22:22:07 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: E4E8:10904:879866:B3ACE9:6886A68F
[android] use a custom Resource.designer.cs (#2606) · dotnet/maui@386af46 · GitHub
Copy file name to clipboardExpand all lines: src/Compatibility/Core/src/Android/Resource.designer.cs
Copy file name to clipboardExpand all lines: src/Controls/src/Core/Platform/Android/Resource.designer.cs
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit 386af46
authored
[android] use a custom Resource.designer.cs (#2606)
Context: https://github.com/jonathanpeppers/CustomResourceDesigner
Context: dotnet/android#6310
We found a systemic problem with Xamarin.Android class libraries:
* Include AndroidX & Google Material
* Include at least one `@(AndroidResource)` and use the ID from C#
* `Resource.designer.cs` has 2,700+ fields. That's a lot!
This problem compounds itself as you include more class libraries that
depend on each other. The main app will end up repeatedly setting
these fields at startup for each library that contains fields in
`Resource.designer.cs`...
Reviewing the .NET MAUI fields, I found:
src\Core\src\obj\Debug\net6.0-android\Resource.designer.cs
5310
src\Controls\src\Core\obj\Debug\net6.0-android\Resource.designer.cs
5167 fields
src\Controls\src\Xaml\obj\Release\net6.0-android\Resource.designer.cs
5167 fields
src\Compatibility\Core\src\obj\Debug\net6.0-android\Resource.designer.cs
5333 fields
src\Essentials\src\obj\Debug\net6.0-android\Resource.designer.cs
204 fields
In fact, I found 21,497 fields were set at startup for a `dotnet new
maui` app in `Resource.designer.cs`!
In many projects you can simply set `$(AndroidGenerateResourceDesigner)`
to `false`, but the issue is .NET MAUI actually uses some of the C#
`Resource.designer.cs` values at runtime.
So to solve the problem here, I came up with a new pattern:
https://github.com/jonathanpeppers/CustomResourceDesigner
We can copy the contents of `Resource.designer.cs` and manually delete
all the fields we don't need. This allows
`$(AndroidGenerateResourceDesigner)` to be turned off.
We are working on a long-term solution for this issue in
Xamarin.Android, but we can do this workaround in .NET MAUI now.
~~ Results ~~
Building a `dotnet new maui` then `dotnet build -c Release` and
running on a Pixel 5.
Before:
* 21,497 fields set at startup in UpdateIdValues()
* Activity Displayed: 1s454ms
* .apk size: 17300275 bytes
After:
* 65 fields set at startup in UpdateIdValues()
* Activity Displayed: 1s079ms
* .apk size: 16677683 bytes
> apkdiff -f before.apk after.apk
Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
- 233 assemblies/Microsoft.Maui.Controls.Compatibility.Android.FormsViewGroup.dll
- 5,264 assemblies/Microsoft.Maui.Essentials.dll
- 103,010 assemblies/Microsoft.Maui.dll
- 103,260 assemblies/Microsoft.Maui.Controls.Compatibility.dll
- 103,811 assemblies/Microsoft.Maui.Controls.Xaml.dll
- 106,127 assemblies/Microsoft.Maui.Controls.dll
- 201,031 assemblies/foo.dll
Summary:
+ 0 Other entries 0.00% (of 2,139,558)
- 622,736 Assemblies -6.93% (of 8,987,664)
+ 0 Dalvik executables 0.00% (of 6,440,988)
+ 0 Shared libraries 0.00% (of 9,860,264)
- 1,340,928 Uncompressed assemblies -6.55% (of 20,465,016)
- 622,592 Package size difference -3.60% (of 17,300,275)1 parent c0d6dfd commit 386af46Copy full SHA for 386af46
File tree
Expand file treeCollapse file tree
5 files changed
+437
-0
lines changedFilter options
- src
- Compatibility/Core/src/Android
- Controls/src/Core/Platform/Android
- Core/src/Platform/Android
Expand file treeCollapse file tree
5 files changed
+437
-0
lines changed+29Lines changed: 29 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
71 | 71 |
| |
72 | 72 |
| |
73 | 73 |
| |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + |
+9Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 |
| |
10 | 19 |
| |
11 | 20 |
| |
|
src/Compatibility/Core/src/Android/Resource.designer.cs
Copy file name to clipboardExpand all lines: src/Compatibility/Core/src/Android/Resource.designer.cs+143Lines changed: 143 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
src/Controls/src/Core/Platform/Android/Resource.designer.cs
Copy file name to clipboardExpand all lines: src/Controls/src/Core/Platform/Android/Resource.designer.cs+140Lines changed: 140 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
You can’t perform that action at this time.
0 commit comments