NativeAOT: Add integration tests for testing MAUI compatibility with NativeAOT on iOS#19194
Conversation
|
Hey there @ivanpovazan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
CI failures are unrelated. |
src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
Outdated
Show resolved
Hide resolved
src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
Outdated
Show resolved
Hide resolved
src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
Outdated
Show resolved
Hide resolved
src/TestUtils/src/Microsoft.Maui.IntegrationTests/TemplateTests.cs
Outdated
Show resolved
Hide resolved
| Code = "IL2067", | ||
| Messages = new List<string> | ||
| { | ||
| "Microsoft.Maui.Controls.ResourceDictionary.<>c.<SetAndLoadSource>b__8_0(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in call to 'System.Activator.CreateInstance(Type)'. The parameter 'key' of method 'Microsoft.Maui.Controls.ResourceDictionary.<>c.<SetAndLoadSource>b__8_0(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.", |
There was a problem hiding this comment.
ResourceDictionary.<>c.b__8_0(Type): 'type'
If b__8_0 changed to b__9_0, for example, what would the test failure look like? Would it be easy for a random dev to understand?
There was a problem hiding this comment.
If b__9_0 starts appearing in the warning message the test would fail with:
Expected warning message 'Microsoft.Maui.Controls.ResourceDictionary.<>c.<SetAndLoadSource>b__8_0(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in call to 'System.Activator.CreateInstance(Type)'. The parameter 'key' of method 'Microsoft.Maui.Controls.ResourceDictionary.<>c.<SetAndLoadSource>b__8_0(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.' was not found for the expected warnings file path 'src/Controls/src/Core/ResourceDictionary.cs' and warning code 'IL2067'
Expected: True
But was: False
Not sure how intuitive it is, but I tried to include as much information as possible.
Nevertheless, I am open for suggestions on providing better error messages.
There was a problem hiding this comment.
I think that is probably good enough for now. We can see if problems come up after merging.
There was a problem hiding this comment.
One idea (if this turns out to be a problem) could be to do a regexp comparison instead, ignoring the anonymous type parts of the names generated by the C# compiler.
src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/BuildWarningsUtilities.cs
Show resolved
Hide resolved
src/TestUtils/src/Microsoft.Maui.IntegrationTests/Utilities/BuildWarningsUtilities.cs
Outdated
Show resolved
Hide resolved
| Code = "IL2067", | ||
| Messages = new List<string> | ||
| { | ||
| "Microsoft.Maui.Controls.ResourceDictionary.<>c.<SetAndLoadSource>b__8_0(Type): 'type' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicParameterlessConstructor' in call to 'System.Activator.CreateInstance(Type)'. The parameter 'key' of method 'Microsoft.Maui.Controls.ResourceDictionary.<>c.<SetAndLoadSource>b__8_0(Type)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to.", |
There was a problem hiding this comment.
One idea (if this turns out to be a problem) could be to do a regexp comparison instead, ignoring the anonymous type parts of the names generated by the C# compiler.
c7cb15e
Description
This PR introduces two new integration tests which are testing MAUI compatibility with NativeAOT on iOS.
The added tests will enable us to catch early any regression in compatibility between MAUI iOS and NativeAOT, but also to guide us forward as we progress with: #18658
Changes
PublishNativeAOT- tests publishing a template MAUI iOS app with NativeAOTPublishNativeAOTCheckWarnings- tests the generated warnings according to NativeAOT: Add integration tests for testing MAUI compatibility with NativeAOT on iOS #19194 (comment)DotnetInternal.ConstructBuildArgswith a common logic for setting up build arguments which is shared between tests callingBuildandPublishtargetsBuildWarningsUtilities.cswhich encapsulates all the logic for parsing, storing and comparing build warningsNOTE: This should be an initial set of tests verifying our progress in the effort of making MAUI trim-compatible (with NativeAOT). The set can and will be expanded to testing on device, covering support for other iOS-platforms with NativeAOT etc, as we progress.
/cc: @jonathanpeppers @simonrozsival