Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[net7.0] Corelib Fixes #15457

Merged
merged 1 commit into from
Jun 6, 2023
Merged

Conversation

hartez
Copy link
Contributor

@hartez hartez commented Jun 5, 2023

Backport of #14546, #14492, #14301 to net7.0

/cc @hartez @jonathanpeppers

Fixes: #9422
Context: https://github.com/dotnet/maui/blob/51df629f946122945cee8f57baed80eb48e45c4e/src/Controls/src/Core/Properties/AssemblyInfo.cs#L79

In `Microsoft.Maui.Core.dll`, the default `x` namespace is defined as:

    [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "System", AssemblyName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]

The problem being that in apps on iOS and Android where
`PublishTrimmed` is `true`, `mscorlib.dll` will get trimmed away and
callsites will use `System.Private.CoreLib.dll` instead.

This is very much related to the issue fixed in 880ce09.

Unfortunately, my fix wasn't sufficient, because the `AssemblyName`
name in this case is the full name:

    AssemblyName = "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

To solve the issue, let's also check for `StartsWith("mscorlib,")`.

We *could* add a new `XmlnsDefinition`, but this doesn't feel right:

    [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2009/xaml", "System", AssemblyName = "System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]

It doesn't make sense for a "private" assembly to appear in XAML
intellisense.

I also moved these tests to a new `XamlTests` class, as it didn't
really make sense to put them with `RadioButton` tests.

Note that these new tests wouldn't fail until we start running device
tests in `Release` mode:

#14392
@rmarinho rmarinho merged commit d692a88 into net7.0 Jun 6, 2023
29 checks passed
@rmarinho rmarinho deleted the backport/pr-corelib-fixes-to-net7.0 branch June 6, 2023 10:38
@github-actions github-actions bot locked and limited conversation to collaborators Dec 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants