CARVIEW |
Select Language
HTTP/2 200
date: Sun, 27 Jul 2025 04:38:55 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/android.git
etag: W/"4c15c106f3c7a6158224614998365e03"
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=fI6yRDlZD5F4r08RfCj9%2BLlthWAd6UlGkwmHRXuHYiqWWlw9bcKaNW4EIPu9EFClSZ%2FRpxW7ZOUE4mFZpTVPUW8Wmffoywo6vHPOChA65id%2FQuQdecTelJ6lh0ymTxb7s8NBUEZzcKRmkoVlJzl8nyPWVUL9zodOvGd%2FxXkg2kvvsXZqXOKGuytsrdm8VPAZBi%2FDW%2FJdno3wNUFuZomMpx6yTbymMOk6V1XHT0C702RqGtpgAZHAKoCNmeDuPoV6PX4gVRCwX8xvP23xQybhwQ%3D%3D--QLnOAHactv9KJuWK--KHn4hyzSDMkBeZN0IpSazQ%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.54149365.1753591134; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 04:38:54 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Mon, 27 Jul 2026 04:38:54 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: 93E6:2F5ED7:AA38EF:E335A7:6885AD5E
[Xamarin.Android.Build.Tasks] use System.Reflection.Metadata in <Reso… · dotnet/android@c22475d · GitHub
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs
Copy file name to clipboard
Copy file name to clipboard
Copy file name to clipboard
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 555
Commit c22475d
[Xamarin.Android.Build.Tasks] use System.Reflection.Metadata in <ResolveAssemblies/> (#2612)
Context: https://github.com/dotnet/corefx/tree/master/src/System.Reflection.Metadata/src/System/Reflection/Metadata
Context: https://github.com/jonathanpeppers/Benchmarks
There is a new System.Reflection.Metadata library from corefx for
reading .NET assemblies. It is a bit more performant than Mono.Cecil
because it is a different library with different opinions.
Some notes about System.Reflection.Metadata (SRM):
- Is a forward "reader" style API, a'la `System.Xml.XmlReader`
- Uses lots of structs, and you have to do an additional call to
lookup strings generally
- Does *not* have APIs to modify and write out new assemblies.
(meaning it's not usable for the linker)
- Only supports "portable" PDB files
- Is not well documented yet. To discover usage, I read source
code and/or unit tests.
From my benchmark above, it seems that SRM is 10x faster on
Windows/.NET framework and 5x faster on macOS/Mono.
It makes sense for use to use SRM when reading assemblies when
symbols aren't needed, and continue with Mono.Cecil for the linker
and other things that modify assemblies.
There are a few places we can take advantage of SRM, but the simplest
with a reasonable impact was the `<ResolveAssemblies/>` task:
Before:
320 ms ResolveAssemblies 1 calls
After:
112 ms ResolveAssemblies 1 calls
A ~200ms savings on this MSBuild task, which runs on *every* build.
This was the Xamarin.Forms test project in this repo: a build with no
changes.
~~ Changes ~~
- Added a `MetadataResolver` type, as a way to cache `PEReader`
instances. This is a comparable drop-in replacement for
`DirectoryAssemblyResolver`.
- `MonoAndroidHelper.IsReferenceAssembly()` now uses
`System.Reflection.Metadata` instead of `Mono.Cecil`. This is
used in a few other MSBuild tasks.
- `MetadataExtensions` provides an extension method to simplify
getting the full name of a custom attribute. We can add more
here as needed.
- Had to adjust the filename reported for XA2002, should optionally
call `Path.GetFileNameWithoutExtension()` if the name ends with
`.dll`.
The resulting code *should* behave the same, except we are using SRM
over Mono.Cecil.
~~ Other changes ~~
[xabuild.exe] remove SRM reference
This appears to fix the build on macOS, we had this workaround from a
mono bump in the past. Since `xabuild` has its own version of
System.Reflection.Metadata that was already loaded, we weren't
loading the one used in XA's MSBuild tasks.
Things appear to work without the reference now.
~~ Downstream ~~
We will need to add the following assemblies to the installer:
- `System.Reflection.Metadata.dll`
- `System.Collections.Immutable.dll`1 parent 974cf7d commit c22475dCopy full SHA for c22475d
File tree
Expand file treeCollapse file tree
8 files changed
+206
-83
lines changedFilter options
- src/Xamarin.Android.Build.Tasks
- Tasks
- Utilities
- tools/xabuild
Expand file treeCollapse file tree
8 files changed
+206
-83
lines changedsrc/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs
Copy file name to clipboardExpand all lines: src/Xamarin.Android.Build.Tasks/Tasks/ResolveAssemblies.cs+60-59Lines changed: 60 additions & 59 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 | 3 |
| |
4 |
| - | |
5 |
| - | |
6 |
| - | |
7 | 4 |
| |
8 | 5 |
| |
9 |
| - | |
10 | 6 |
| |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 |
| |
| 12 | + | |
| 13 | + | |
12 | 14 |
| |
13 | 15 |
| |
14 |
| - | |
15 |
| - | |
16 |
| - | |
17 |
| - | |
18 |
| - | |
19 | 16 |
| |
20 | 17 |
| |
21 | 18 |
| |
| |||
62 | 59 |
| |
63 | 60 |
| |
64 | 61 |
| |
65 |
| - | |
| 62 | + | |
66 | 63 |
| |
67 | 64 |
| |
68 | 65 |
| |
| |||
72 | 69 |
| |
73 | 70 |
| |
74 | 71 |
| |
75 |
| - | |
| 72 | + | |
76 | 73 |
| |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
| 74 | + | |
| 75 | + | |
81 | 76 |
| |
82 |
| - | |
| 77 | + | |
| 78 | + | |
83 | 79 |
| |
84 | 80 |
| |
85 | 81 |
| |
| |||
92 | 88 |
| |
93 | 89 |
| |
94 | 90 |
| |
95 |
| - | |
96 |
| - | |
97 |
| - | |
| 91 | + | |
98 | 92 |
| |
99 | 93 |
| |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
| 94 | + | |
| 95 | + | |
104 | 96 |
| |
105 |
| - | |
106 | 97 |
| |
107 |
| - | |
108 |
| - | |
109 |
| - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
110 | 101 |
| |
111 | 102 |
| |
112 | 103 |
| |
113 |
| - | |
| 104 | + | |
114 | 105 |
| |
115 |
| - | |
| 106 | + | |
116 | 107 |
| |
117 | 108 |
| |
118 | 109 |
| |
119 | 110 |
| |
120 |
| - | |
| 111 | + | |
| 112 | + | |
121 | 113 |
| |
122 | 114 |
| |
123 | 115 |
| |
| |||
171 | 163 |
| |
172 | 164 |
| |
173 | 165 |
| |
174 |
| - | |
| 166 | + | |
175 | 167 |
| |
176 | 168 |
| |
177 | 169 |
| |
| |||
200 | 192 |
| |
201 | 193 |
| |
202 | 194 |
| |
203 |
| - | |
204 |
| - | |
| 195 | + | |
205 | 196 |
| |
206 | 197 |
| |
207 | 198 |
| |
208 | 199 |
| |
209 |
| - | |
| 200 | + | |
210 | 201 |
| |
211 |
| - | |
212 |
| - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
213 | 205 |
| |
214 | 206 |
| |
215 | 207 |
| |
| |||
219 | 211 |
| |
220 | 212 |
| |
221 | 213 |
| |
222 |
| - | |
| 214 | + | |
223 | 215 |
| |
224 |
| - | |
225 |
| - | |
| 216 | + | |
| 217 | + | |
226 | 218 |
| |
227 | 219 |
| |
228 | 220 |
| |
229 | 221 |
| |
230 |
| - | |
| 222 | + | |
231 | 223 |
| |
232 | 224 |
| |
233 | 225 |
| |
234 |
| - | |
235 |
| - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
236 | 229 |
| |
237 |
| - | |
| 230 | + | |
238 | 231 |
| |
239 | 232 |
| |
240 | 233 |
| |
| |||
245 | 238 |
| |
246 | 239 |
| |
247 | 240 |
| |
248 |
| - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
249 | 245 |
| |
250 | 246 |
| |
251 | 247 |
| |
| |||
261 | 257 |
| |
262 | 258 |
| |
263 | 259 |
| |
264 |
| - | |
| 260 | + | |
265 | 261 |
| |
266 |
| - | |
267 |
| - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
268 | 265 |
| |
269 |
| - | |
270 |
| - | |
271 |
| - | |
272 |
| - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
273 | 273 |
| |
274 | 274 |
| |
275 | 275 |
| |
276 |
| - | |
277 |
| - | |
278 |
| - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
279 | 280 |
| |
280 | 281 |
| |
281 | 282 |
| |
282 |
| - | |
| 283 | + | |
283 | 284 |
| |
284 | 285 |
| |
285 | 286 |
| |
| |||
305 | 306 |
| |
306 | 307 |
| |
307 | 308 |
| |
308 |
| - | |
| 309 | + | |
309 | 310 |
| |
310 | 311 |
| |
311 | 312 |
| |
| |||
332 | 333 |
| |
333 | 334 |
| |
334 | 335 |
| |
335 |
| - | |
| 336 | + | |
336 | 337 |
| |
337 |
| - | |
338 |
| - | |
| 338 | + | |
| 339 | + | |
339 | 340 |
| |
340 | 341 |
| |
341 | 342 |
| |
|
src/Xamarin.Android.Build.Tasks/Utilities/DummyCustomAttributeProvider.cs
Copy file name to clipboard+34Lines changed: 34 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 | + |
src/Xamarin.Android.Build.Tasks/Utilities/MetadataExtensions.cs
Copy file name to clipboard+26Lines changed: 26 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 | + |
src/Xamarin.Android.Build.Tasks/Utilities/MetadataResolver.cs
Copy file name to clipboard+60Lines changed: 60 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 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + |
You can’t perform that action at this time.
0 commit comments