Commit 59b2e51
committed
chore: .NET 9 build fixes
Fix a JSON trimmer error:
src/Uno.Extensions.Authentication.MSAL/MsalAuthenticationProvider.cs(249,52): error IL2026:
Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code.
JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Update `MsalAuthenticationProvider.cs` to use `System.Text.Json`
[Source Generators][0].
"Fix" or otherwise silence trimmer errors (?!):
uno.extensions/src/Uno.Extensions.Hosting.UI/UnoHost.cs(105,42): error IL2026:
Using member 'Microsoft.Extensions.DependencyInjection.OptionsConfigurationServiceCollectionExtensions.Configure<TOptions>(IServiceCollection, IConfiguration)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code.
TOptions's dependent types may have their members trimmed.
Ensure all required members are preserved.
In this case I'm not sure what the correct fix *is*, so use
`[UnconditionalSuppressMessage]` to silence the underlying warning.
src/Uno.Extensions.Navigation.UI/RouteResolverDefault.cs(261,11): error IL2026:
Using member 'System.Reflection.Assembly.GetTypes()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code.
Types might be removed.
Add `[RequiresUnreferencedCode]` to `AssemblyExtensions.SafeGetTypes()`
and `RouteResolverDefault.LoadedTypes` (calls `.SafeGetTypes()`), then
use `[UnconditionalSuppressMessage]` to "limit the contagion" of the
`[RequiresUnreferencedCode]` on `.LoadedTypes`.
[0]: https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/source-generation1 parent 1562b28 commit 59b2e51
3 files changed
Lines changed: 49 additions & 7 deletions
File tree
- src
- Uno.Extensions.Authentication.MSAL
- Uno.Extensions.Hosting.UI
Lines changed: 23 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
249 | | - | |
| 252 | + | |
250 | 253 | | |
251 | 254 | | |
252 | 255 | | |
| |||
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
271 | 285 | | |
272 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
| |||
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | | - | |
| 64 | + | |
63 | 65 | | |
64 | 66 | | |
65 | 67 | | |
| |||
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | | - | |
106 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
107 | 117 | | |
108 | 118 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
160 | 161 | | |
161 | 162 | | |
162 | 163 | | |
163 | | - | |
| 164 | + | |
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
| |||
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
182 | 189 | | |
183 | 190 | | |
184 | 191 | | |
| |||
235 | 242 | | |
236 | 243 | | |
237 | 244 | | |
| 245 | + | |
238 | 246 | | |
239 | 247 | | |
240 | 248 | | |
| |||
254 | 262 | | |
255 | 263 | | |
256 | 264 | | |
| 265 | + | |
| 266 | + | |
257 | 267 | | |
258 | 268 | | |
259 | 269 | | |
| |||
0 commit comments