Open pictos opened 13 hours ago
This seems unrelated to AOT, the <XamlCTask/>
is failing to write an assembly, Mono.Cecil
is giving this error:
If you use System.IComparable
in your assembly somewhere, does it fix it? I think you could literally just make a method that isn't called?
If you use System.IComparable in your assembly somewhere, does it fix it? I think you could literally just make a method that isn't called?
Yes, we use IComparable
in the CommunityToolkit.Maui
library.
I tried implementing IComaprable
in the CommunityToolkit.Maui.Sample
sample app and it did not solve the build error.
Do you know what specific XAML file (or element) causes the problem?
I don't know for sure; I can only guess.
Here is where we are using IConverter
in CommunityToolkit.Maui
for CompareConverter
: https://github.com/CommunityToolkit/Maui/blob/0e991c2cc08791a6fbf5fdc909714ba2537a0ee6/src/CommunityToolkit.Maui/Converters/CompareConverter.shared.cs
And here is where we are demo'ing CompareConverter
in CommunityToolkit.Maui.Sample
:
https://github.com/CommunityToolkit/Maui/blob/0e991c2cc08791a6fbf5fdc909714ba2537a0ee6/samples/CommunityToolkit.Maui.Sample/Pages/Converters/CompareConverterPage.xaml
I have performed some investigations this morning and I believe I can pinpoint the specific usage that is causing this. We see the error being reported from this line
If I comment the above line out then the project will compile. Note that this inside a Popup.
Furthermore if I take that same binding and place it in here https://github.com/CommunityToolkit/Maui/blob/main/samples/CommunityToolkit.Maui.Sample/Pages/Converters/CompareConverterPage.xaml changing the property to SliderValue
and the namespace to mct
then the code will happily compile. Note that this inside a ContentPage.
I suspect that the XAMLC is somehow not performing the same tasks for our Popup
XAML that it is for ContentPage
XAML.
In case it helps for the context of finding the issue I can workaround the problem by creating a subclass of our CompareConverter
e.g.
using CommunityToolkit.Maui.Converters;
namespace CommunityToolkit.Maui.Sample.Converters;
/// <summary>
/// Compares a double value against the ComparingValue property
/// and returns a <see cref="bool"/> based on the comparison.
/// </summary>
[AcceptEmptyServiceProvider]
public sealed partial class CompareDoubleToBooleanConverter : CompareConverter<double, bool>
{
}
and then using this in the UpdatingPopup.xaml file.
Description
When building an app using AoT in release mode it breaks during build with the error message:
Steps to Reproduce
feature/sl-dotnet-nine
branch\samples\CommunityToolkit.Maui.Sample
dotnet build -c Release -bl
Binlog: msbuild.zip
Link to public reproduction project repository
https://github.com/CommunityToolkit/Maui/tree/feature/sl-dotnet-nine
Version with bug
9.0.10 SR1
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.100 SR10
Affected platforms
iOS, Android, Windows, macOS
Affected platform versions
All versions
Did you find any workaround?
N/A
Relevant log output