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

Build Debug and Release device tests #14392

Closed
wants to merge 2 commits into from
Closed

Conversation

mattleibow
Copy link
Member

Description of Change

Current state:

  • Android: Debug
  • iOS: Release

This PR:

Everything is both Debug and Release

Issues Fixed

Fixes #14390

@rmarinho
Copy link
Member

rmarinho commented Apr 4, 2023

Seems @mandel-macaque wants to make this consume the nupkg created here, and we already build them in debug/release

@rmarinho
Copy link
Member

rmarinho commented Apr 5, 2023

seems some failures on release mode for Android, soem related with leak tests, any ideas @jonathanpeppers @PureWeen ?

jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Apr 10, 2023
In 880ce09, I made XamlC try `System.Private.CoreLib` for XAML like:

    xmlns:sys="clr-namespace:System;assembly=mscorlib"

This fixed cases where `mscorlib.dll` is trimmed away in `Release` mode.

However, building the device tests this morning in `Release` mode I
got the error:

    Elements\RadioButton\RadioButtonUsing.xaml Failed to resolve assembly: 'System.Private.CoreLib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    at Microsoft.Maui.Controls.Build.Tasks.XamlCAssemblyResolver.Resolve(AssemblyNameReference name) in C:\src\maui\src\Controls\src\Build.Tasks\XamlCAssemblyResolver.cs:line 25
    at Microsoft.Maui.Controls.Build.Tasks.ModuleDefinitionExtensions.<>c__DisplayClass21_0.<GetTypeDefinition>b__0(ValueTuple`2 x) in C:\src\maui\src\Controls\src\Build.Tasks\ModuleDefinitionExtensions.cs:line 257
    at Microsoft.Maui.Controls.Build.Tasks.XamlCache.GetOrAdd[TKey,TValue](Dictionary`2 dictionary, TKey key, Func`2 valueFactory) in C:\src\maui\src\Controls\src\Build.Tasks\XamlCache.cs:line 27
    at Microsoft.Maui.Controls.Build.Tasks.ModuleDefinitionExtensions.GetTypeDefinition(ModuleDefinition module, XamlCache cache, ValueTuple`3 type) in C:\src\maui\src\Controls\src\Build.Tasks\ModuleDefinitionExtensions.cs:line 255
    at Microsoft.Maui.Controls.Build.Tasks.XmlTypeExtensions.<>c__DisplayClass3_0.<TryGetTypeReference>b__0(ValueTuple`3 typeInfo) in C:\src\maui\src\Controls\src\Build.Tasks\XmlTypeExtensions.cs:line 88
    at Microsoft.Maui.Controls.Xaml.XmlTypeXamlExtensions.GetTypeReference[T](XmlType xmlType, IEnumerable`1 xmlnsDefinitions, String defaultAssemblyName, Func`2 refFromTypeInfo) in C:\src\maui\src\Controls\src\Xaml\XmlTypeXamlExtensions.cs:line 96
    at Microsoft.Maui.Controls.Build.Tasks.XmlTypeExtensions.TryGetTypeReference(XmlType xmlType, XamlCache cache, ModuleDefinition module, IXmlLineInfo xmlInfo, TypeReference& typeReference) in C:\src\maui\src\Controls\src\Build.Tasks\XmlTypeExtensions.cs:line 85
    at Microsoft.Maui.Controls.Build.Tasks.XmlTypeExtensions.GetTypeReference(XmlType xmlType, XamlCache cache, ModuleDefinition module, IXmlLineInfo xmlInfo) in C:\src\maui\src\Controls\src\Build.Tasks\XmlTypeExtensions.cs:line 99
    at Microsoft.Maui.Controls.Build.Tasks.CreateObjectVisitor.Visit(ElementNode node, INode parentNode)
    at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode) in C:\src\maui\src\Controls\src\Xaml\XamlNode.cs:line 161
    at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode) in C:\src\maui\src\Controls\src\Xaml\XamlNode.cs:line 152
    at Microsoft.Maui.Controls.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode) in C:\src\maui\src\Controls\src\Xaml\XamlNode.cs:line 209
    at Microsoft.Maui.Controls.Build.Tasks.XamlCTask.TryCoreCompile(MethodDefinition initComp, ILRootNode rootnode, String xamlFilePath, TaskLoggingHelper loggingHelper, Exception& exception) in C:\src\maui\src\Controls\src\Build.Tasks\XamlCTask.cs:line 280

`XamlCAssemblyResolver` needed to add a case for `System.Private.CoreLib`.

I'm not sure why I didn't hit this earlier, but we should hopefully
catch this on CI next time when this one lands:

dotnet#14392
@jonathanpeppers
Copy link
Member

The memory leak tests are passing for me locally on device & emulator, but I found this issue: #14492

Let me try it a few more times.

@jonathanpeppers
Copy link
Member

Ok, if I restart the app and Run All, it took two tries to get:

image

@Eilon Eilon added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Apr 10, 2023
@jonathanpeppers
Copy link
Member

I pushed a change that seems like it made these tests pass 3 times in a row in Release mode. Let's see how it does on CI?

@rmarinho
Copy link
Member

/rebase

mattleibow and others added 2 commits April 11, 2023 00:28
@github-actions github-actions bot force-pushed the dev/release-tests branch from 9977e99 to c8a9b81 Compare April 11, 2023 00:29
@rmarinho
Copy link
Member

Ok these look real failures on Android in release, IsInAccessibleTree

https://dev.azure.com/xamarin/public/_build/results?buildId=84050&view=ms.vss-test-web.build-test-results-tab

PureWeen pushed a commit that referenced this pull request Apr 11, 2023
In 880ce09, I made XamlC try `System.Private.CoreLib` for XAML like:

    xmlns:sys="clr-namespace:System;assembly=mscorlib"

This fixed cases where `mscorlib.dll` is trimmed away in `Release` mode.

However, building the device tests this morning in `Release` mode I
got the error:

    Elements\RadioButton\RadioButtonUsing.xaml Failed to resolve assembly: 'System.Private.CoreLib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    at Microsoft.Maui.Controls.Build.Tasks.XamlCAssemblyResolver.Resolve(AssemblyNameReference name) in C:\src\maui\src\Controls\src\Build.Tasks\XamlCAssemblyResolver.cs:line 25
    at Microsoft.Maui.Controls.Build.Tasks.ModuleDefinitionExtensions.<>c__DisplayClass21_0.<GetTypeDefinition>b__0(ValueTuple`2 x) in C:\src\maui\src\Controls\src\Build.Tasks\ModuleDefinitionExtensions.cs:line 257
    at Microsoft.Maui.Controls.Build.Tasks.XamlCache.GetOrAdd[TKey,TValue](Dictionary`2 dictionary, TKey key, Func`2 valueFactory) in C:\src\maui\src\Controls\src\Build.Tasks\XamlCache.cs:line 27
    at Microsoft.Maui.Controls.Build.Tasks.ModuleDefinitionExtensions.GetTypeDefinition(ModuleDefinition module, XamlCache cache, ValueTuple`3 type) in C:\src\maui\src\Controls\src\Build.Tasks\ModuleDefinitionExtensions.cs:line 255
    at Microsoft.Maui.Controls.Build.Tasks.XmlTypeExtensions.<>c__DisplayClass3_0.<TryGetTypeReference>b__0(ValueTuple`3 typeInfo) in C:\src\maui\src\Controls\src\Build.Tasks\XmlTypeExtensions.cs:line 88
    at Microsoft.Maui.Controls.Xaml.XmlTypeXamlExtensions.GetTypeReference[T](XmlType xmlType, IEnumerable`1 xmlnsDefinitions, String defaultAssemblyName, Func`2 refFromTypeInfo) in C:\src\maui\src\Controls\src\Xaml\XmlTypeXamlExtensions.cs:line 96
    at Microsoft.Maui.Controls.Build.Tasks.XmlTypeExtensions.TryGetTypeReference(XmlType xmlType, XamlCache cache, ModuleDefinition module, IXmlLineInfo xmlInfo, TypeReference& typeReference) in C:\src\maui\src\Controls\src\Build.Tasks\XmlTypeExtensions.cs:line 85
    at Microsoft.Maui.Controls.Build.Tasks.XmlTypeExtensions.GetTypeReference(XmlType xmlType, XamlCache cache, ModuleDefinition module, IXmlLineInfo xmlInfo) in C:\src\maui\src\Controls\src\Build.Tasks\XmlTypeExtensions.cs:line 99
    at Microsoft.Maui.Controls.Build.Tasks.CreateObjectVisitor.Visit(ElementNode node, INode parentNode)
    at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode) in C:\src\maui\src\Controls\src\Xaml\XamlNode.cs:line 161
    at Microsoft.Maui.Controls.Xaml.ElementNode.Accept(IXamlNodeVisitor visitor, INode parentNode) in C:\src\maui\src\Controls\src\Xaml\XamlNode.cs:line 152
    at Microsoft.Maui.Controls.Xaml.RootNode.Accept(IXamlNodeVisitor visitor, INode parentNode) in C:\src\maui\src\Controls\src\Xaml\XamlNode.cs:line 209
    at Microsoft.Maui.Controls.Build.Tasks.XamlCTask.TryCoreCompile(MethodDefinition initComp, ILRootNode rootnode, String xamlFilePath, TaskLoggingHelper loggingHelper, Exception& exception) in C:\src\maui\src\Controls\src\Build.Tasks\XamlCTask.cs:line 280

`XamlCAssemblyResolver` needed to add a case for `System.Private.CoreLib`.

I'm not sure why I didn't hit this earlier, but we should hopefully
catch this on CI next time when this one lands:

#14392
jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Apr 12, 2023
Fixes: dotnet#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:

dotnet#14392
jonathanpeppers added a commit that referenced this pull request Apr 17, 2023
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
Copy link
Member

Seems we still have 2 failing tests on android/ release

IsInAccessibleTree and ExcludedWithChildren

@rmarinho
Copy link
Member

/rebase

hartez added a commit that referenced this pull request Jun 5, 2023
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 pushed a commit that referenced this pull request Jun 6, 2023
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
@mattleibow mattleibow closed this Jun 20, 2023
@mattleibow mattleibow deleted the dev/release-tests branch June 20, 2023 22:13
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Release test runs for Device Tests
4 participants