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

Fixed Microsoft.Maui.Controls 8.0.90 (Latest stable) Ruins Entry Controls #25006

Merged
merged 30 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9670c6a
Fixed Microsoft.Maui.Controls 8.0.90 (Latest stable) Ruins Entry Cont…
NirmalKumarYuvaraj Sep 30, 2024
270b996
Added test cases
NirmalKumarYuvaraj Oct 3, 2024
17c6812
Merge branch 'main' of https://github.com/NirmalKumarYuvaraj/maui int…
NirmalKumarYuvaraj Oct 3, 2024
606bd95
updated test case method name
NirmalKumarYuvaraj Oct 3, 2024
54a6883
Added automation id
NirmalKumarYuvaraj Oct 4, 2024
269de76
Added pending test snapshot
jsuarezruiz Oct 7, 2024
8cdf977
Added images for android and IOS
NirmalKumarYuvaraj Oct 8, 2024
b6378fa
Merge branch 'fix-24783' of https://github.com/NirmalKumarYuvaraj/mau…
NirmalKumarYuvaraj Oct 8, 2024
b7245c3
Fixed Microsoft.Maui.Controls 8.0.90 (Latest stable) Ruins Entry Cont…
NirmalKumarYuvaraj Sep 30, 2024
02850ce
Added test cases
NirmalKumarYuvaraj Oct 3, 2024
18fffcf
updated test case method name
NirmalKumarYuvaraj Oct 3, 2024
2a5eb1a
Added automation id
NirmalKumarYuvaraj Oct 4, 2024
6709a0a
Added images for android and IOS
NirmalKumarYuvaraj Oct 8, 2024
3f66bbb
Added pending test snapshot
jsuarezruiz Oct 7, 2024
daef7ed
Modified ios image
NirmalKumarYuvaraj Oct 9, 2024
15000b8
Merge branch 'fix-24783' of https://github.com/NirmalKumarYuvaraj/mau…
NirmalKumarYuvaraj Oct 9, 2024
6f24a10
revert unwanted changes
NirmalKumarYuvaraj Oct 9, 2024
586f5c2
Revert "Added pending test snapshot"
NirmalKumarYuvaraj Oct 9, 2024
8d50a3c
Merge branch 'fix-24783' of https://github.com/NirmalKumarYuvaraj/mau…
NirmalKumarYuvaraj Oct 9, 2024
8d59b7b
modified code changes
NirmalKumarYuvaraj Oct 9, 2024
dd65898
Revert "Added pending test snapshot"
NirmalKumarYuvaraj Oct 9, 2024
50a8a12
Reapply "Added pending test snapshot"
NirmalKumarYuvaraj Oct 9, 2024
4ca5d38
Added pending test snapshot
jsuarezruiz Oct 7, 2024
1517643
dummy
NirmalKumarYuvaraj Oct 9, 2024
ddd13dd
Merge branch 'fix-24783' of https://github.com/NirmalKumarYuvaraj/mau…
NirmalKumarYuvaraj Oct 9, 2024
866f6ce
Revert "Merge branch 'fix-24783' of https://github.com/NirmalKumarYuv…
NirmalKumarYuvaraj Oct 9, 2024
f036290
Revert "Merge branch 'fix-24783' of https://github.com/NirmalKumarYuv…
NirmalKumarYuvaraj Oct 9, 2024
9b5c9a2
reverted all the changes
NirmalKumarYuvaraj Oct 9, 2024
c99cbc9
Added missing test cases and images
NirmalKumarYuvaraj Oct 9, 2024
8c1d745
removed unwanted images and files
NirmalKumarYuvaraj Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
]
},
"microsoft.dotnet.xharness.cli": {
"version": "10.0.0-prerelease.24501.1",
"version": "10.0.0-prerelease.24476.1",
"commands": [
"xharness"
]
Expand Down
12 changes: 6 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Common" Version="10.0.0-prerelease.24501.1">
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Common" Version="10.0.0-prerelease.24476.1">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>2b6293f14cf55326dde74b1364d12c579a8bd569</Sha>
<Sha>7d5c32dbda0c6c8b9dc20cde4e1261b191896138</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="10.0.0-prerelease.24501.1">
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="10.0.0-prerelease.24476.1">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>2b6293f14cf55326dde74b1364d12c579a8bd569</Sha>
<Sha>7d5c32dbda0c6c8b9dc20cde4e1261b191896138</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="10.0.0-prerelease.24501.1">
<Dependency Name="Microsoft.DotNet.XHarness.CLI" Version="10.0.0-prerelease.24476.1">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>2b6293f14cf55326dde74b1364d12c579a8bd569</Sha>
<Sha>7d5c32dbda0c6c8b9dc20cde4e1261b191896138</Sha>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
<_HarfBuzzSharpVersion>7.3.0.2</_HarfBuzzSharpVersion>
<_SkiaSharpNativeAssetsVersion>0.0.0-commit.7af1d0840a381c0ce7ef2877454a88dbb2949686.1086</_SkiaSharpNativeAssetsVersion>
<MicrosoftTemplateEngineTasksVersion>7.0.114</MicrosoftTemplateEngineTasksVersion>
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>10.0.0-prerelease.24501.1</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>10.0.0-prerelease.24501.1</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<MicrosoftDotNetXHarnessCLIVersion>10.0.0-prerelease.24501.1</MicrosoftDotNetXHarnessCLIVersion>
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>10.0.0-prerelease.24476.1</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>10.0.0-prerelease.24476.1</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<MicrosoftDotNetXHarnessCLIVersion>10.0.0-prerelease.24476.1</MicrosoftDotNetXHarnessCLIVersion>
<TizenUIExtensionsVersion>0.9.2</TizenUIExtensionsVersion>
<SvgSkiaPackageVersion>1.0.0.16</SvgSkiaPackageVersion>
<FizzlerPackageVersion>1.3.0</FizzlerPackageVersion>
Expand Down
25 changes: 25 additions & 0 deletions src/Controls/docs/Microsoft.Maui.Controls/DataTemplateSelector.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,31 @@
<Interfaces />
<Docs>
<summary>Selects <see cref="T:Microsoft.Maui.Controls.DataTemplate" /> objects by data type and container.</summary>
<remarks>
<para>Application developers override the <see cref="M:Microsoft.Maui.Controls.DataTemplateSelector.OnSelectTemplate(System.Object,Microsoft.Maui.Controls.BindableObject)" /> method to return a unique <see cref="T:Microsoft.Maui.Controls.DataTemplate" /> for a data type and parent container combination. Additionally, because the same exact template instance must be returned for a given piece of data across successive calls to <see cref="M:Microsoft.Maui.Controls.DataTemplateSelector.SelectTemplate(System.Object,Microsoft.Maui.Controls.BindableObject)" />, developers should create and store these <see cref="T:Microsoft.Maui.Controls.DataTemplate" /> in their constructor overrides.</para>
Developers should note the following items: <list type="bullet"><item><term>OnSelectTemplate must not return another DataTemplateSelector, and
</term></item><item><term>The Android platform is limited to 20 templates per list view.</term></item></list>
<example>The following example shows a basic use:
<code lang="c#"><![CDATA[class MyDataTemplateSelector : DataTemplateSelector
{
public MyDataTemplateSelector ()
{
// Retain instances
this.templateOne = new DataTemplate (typeof (ViewA));
this.templateTwo = new DataTemplate (typeof (ViewB));
}

protected override DataTemplate OnSelectTemplate (object item, BindableObject container)
{
if (item is double)
return this.templateOne;
return this.templateTwo;
}

private readonly DataTemplate templateOne;
private readonly DataTemplate templateTwo;
}]]></code></example>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,6 @@ public void Visit(ElementNode node, INode parentNode)
}
if (setNameScope && Context.Variables[node].VariableType.InheritsFromOrImplements(Context.Cache, Context.Body.Method.Module.ImportReference(Context.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "BindableObject"))))
SetNameScope(node, namescopeVarDef);
//workaround when VSM tries to apply state before parenting
else if (Context.Variables[node].VariableType.InheritsFromOrImplements(Context.Cache, Context.Body.Method.Module.ImportReference(Context.Cache, ("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "Element"))))
{
var module = Context.Body.Method.Module;
var parameterTypes = new[] {
("Microsoft.Maui.Controls", "Microsoft.Maui.Controls", "Element"),
("Microsoft.Maui.Controls", "Microsoft.Maui.Controls.Internals", "INameScope"),
};
Context.IL.Append(Context.Variables[node].LoadAs(Context.Cache, module.GetTypeDefinition(Context.Cache, parameterTypes[0]), module));
Context.IL.Append(namescopeVarDef.LoadAs(Context.Cache, module.GetTypeDefinition(Context.Cache, parameterTypes[1]), module));
Context.IL.Emit(OpCodes.Stfld, module.ImportFieldReference(Context.Cache, parameterTypes[0], nameof(Element.transientNamescope)));
}
Context.Scopes[node] = new Tuple<VariableDefinition, IList<string>>(namescopeVarDef, namesInNamescope);
}

Expand Down
8 changes: 1 addition & 7 deletions src/Controls/src/Core/Element/Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -502,19 +502,13 @@ public bool EffectIsAttached(string name)
return false;
}

//this is only used by XAMLC, not added to public API
[EditorBrowsable(EditorBrowsableState.Never)]
#pragma warning disable RS0016 // Add public types and members to the declared API
public INameScope transientNamescope;
#pragma warning restore RS0016 // Add public types and members to the declared API

/// <summary>Returns the element that has the specified name.</summary>
/// <param name="name">The name of the element to be found.</param>
/// <returns>The element that has the specified name.</returns>
/// <exception cref="InvalidOperationException">Thrown if the element's namescope couldn't be found.</exception>
public object FindByName(string name)
{
var namescope = GetNameScope() ?? transientNamescope;
var namescope = GetNameScope();
if (namescope == null)
throw new InvalidOperationException("this element is not in a namescope");
return namescope.FindByName(name);
Expand Down
1 change: 0 additions & 1 deletion src/Controls/src/Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
[assembly: InternalsVisibleTo("Microsoft.Maui.Controls.Foldable.UnitTests")]
[assembly: InternalsVisibleTo("WinUI.UITests")]
[assembly: InternalsVisibleTo("Microsoft.Maui.Controls.DeviceTests")]
[assembly: InternalsVisibleTo("Controls.TestCases.HostApp")]

[assembly: InternalsVisibleTo("CommunityToolkit.Maui")]
[assembly: InternalsVisibleTo("CommunityToolkit.Maui.Core")]
Expand Down
5 changes: 0 additions & 5 deletions src/Controls/src/Xaml/CreateValuesVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,6 @@ public void Visit(ElementNode node, INode parentNode)
if (value is BindableObject bindableValue && node.NameScopeRef != (parentNode as IElementNode)?.NameScopeRef)
NameScope.SetNameScope(bindableValue, node.NameScopeRef.NameScope);

//Workaround for when a VSM is applied before parenting
if (value is Element iElement)
iElement.transientNamescope = node.NameScopeRef.NameScope;


var assemblyName = (Context.RootAssembly ?? Context.RootElement?.GetType().Assembly)?.GetName().Name;
if (assemblyName != null && value != null && !value.GetType().IsValueType && XamlFilePathAttribute.GetFilePathForObject(Context.RootElement) is string path)
VisualDiagnostics.RegisterSourceInfo(value, new Uri($"{path};assembly={assemblyName}", UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla23942.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" ?>
<local:TestContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:test="clr-namespace:Maui.Controls.Sample.Issues"
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
x:Class="Maui.Controls.Sample.Issues.Bugzilla23942">

<local:TestContentPage.Resources>
<ResourceDictionary>
<test:Bugzilla23942Options x:Key="opts"
Text="{Binding DoesItWork}" />
</ResourceDictionary>
</local:TestContentPage.Resources>

<local:TestContentPage.Content>
<StackLayout>
<test:Bugzilla23942Label x:Name="label" Options="{DynamicResource opts}" />
</StackLayout>
</local:TestContentPage.Content>

</local:TestContentPage>
97 changes: 97 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla23942.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.CustomAttributes;
using Microsoft.Maui.Controls.Internals;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 23942, "Cannot bind properties in BindableObjects added to static resources in XAML", PlatformAffected.All)]
public partial class Bugzilla23942 : TestContentPage
{
[Preserve(AllMembers = true)]
public class TestViewModel : ViewModelBase
{
string _doesItWork;
public string DoesItWork
{
get
{
return _doesItWork;
}
set
{
_doesItWork = value;
OnPropertyChanged();
}
}
}

public Bugzilla23942()
{
InitializeComponent();
}

private void InitializeView()
{
TestViewModel vm = new TestViewModel() { DoesItWork = "initial binding works" };
BindingContext = vm;
vm.DoesItWork = "success";
}

protected override void Init()
{
InitializeView();
}

protected override void OnAppearing()
{
base.OnAppearing();
var lbl = this.FindByName<Bugzilla23942Label>("label");
lbl.Text = lbl.Options.Text;
}
}

[Preserve(AllMembers = true)]
public class Bugzilla23942Options : BindableObject
{
public static readonly BindableProperty TextProperty =
BindableProperty.Create(propertyName: nameof(Text),
returnType: typeof(string),
declaringType: typeof(Bugzilla23942Options),
defaultValue: default(string));

public string Text
{
get
{
return (string)GetValue(TextProperty);
}
set
{
SetValue(TextProperty, value);
}
}
}

[Preserve(AllMembers = true)]
public class Bugzilla23942Label : Label
{
public static readonly BindableProperty OptionsProperty =
BindableProperty.Create(propertyName: nameof(Options),
returnType: typeof(Bugzilla23942Options),
declaringType: typeof(Bugzilla23942Label),
defaultValue: default(Bugzilla23942Options));

public Bugzilla23942Options Options
{
get
{
return (Bugzilla23942Options)GetValue(OptionsProperty);
}
set
{
SetValue(OptionsProperty, value);
}
}
}
}
82 changes: 82 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Bugzilla25943.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Internals;
using Microsoft.Maui.Graphics;

namespace Maui.Controls.Sample.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Bugzilla, 25943,
"[Android] TapGestureRecognizer does not work with a nested StackLayout", PlatformAffected.Android)]
public class Bugzilla25943 : TestContentPage
{
Label _result;
int _taps;
const string InnerLayout = "innerlayout";
const string OuterLayout = "outerlayout";
const string Success = "Success";

protected override void Init()
{
StackLayout layout = GetNestedStackLayout();

var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += (sender, e) =>
{
_taps = _taps + 1;
if (_taps == 2)
{
_result.Text = Success;
}
};
layout.GestureRecognizers.Add(tapGestureRecognizer);

Content = layout;
}

public StackLayout GetNestedStackLayout()
{
_result = new Label();

#pragma warning disable CS0618 // Type or member is obsolete
var innerLayout = new StackLayout
{
AutomationId = InnerLayout,
HeightRequest = 100,
Orientation = StackOrientation.Horizontal,
HorizontalOptions = LayoutOptions.Fill,
BackgroundColor = Colors.AntiqueWhite,
Children =
{
new Label
{
Text = "inner label",
FontSize = 20,
HorizontalOptions = LayoutOptions.Center,
VerticalOptions = LayoutOptions.CenterAndExpand
}
}
};
#pragma warning restore CS0618 // Type or member is obsolete

var outerLayout = new StackLayout
{
AutomationId = OuterLayout,
Orientation = StackOrientation.Vertical,
BackgroundColor = Colors.Brown,
Children =
{
_result,
innerLayout,
new Label
{
Text = "outer label",
FontSize = 20,
HorizontalOptions = LayoutOptions.Center,
}
}
};

return outerLayout;
}
}
}
Loading