Skip to content

Commit 69a4cfc

Browse files
authored
[net9.0] Merge main to net9.0 (#22840)
### Description of Change Bring latest changes from main to net9 branch
2 parents 13942bd + 5f8e144 commit 69a4cfc

File tree

50 files changed

+841
-219
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+841
-219
lines changed

.github/ISSUE_TEMPLATE/bug-report.yml

-10
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,6 @@ body:
5757
- 8.0.7 SR2
5858
- 8.0.6 SR1
5959
- 8.0.3 GA
60-
- 7.0.101
61-
- 7.0.100
62-
- 7.0.96
63-
- 7.0.92
64-
- 7.0.86
65-
- 7.0.81
66-
- 7.0.59
67-
- 7.0.58
68-
- 7.0.52
69-
- 7.0.49
7060
- Nightly / CI build (Please specify exact version)
7161
- Unknown/Other
7262
validations:

NuGet.config

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3+
4+
<!-- Define the package sources: all mirrors or internal feeds. -->
5+
<!-- `clear` ensures no additional sources are inherited from another config file. -->
36
<packageSources>
47
<clear />
58

@@ -17,7 +20,8 @@
1720
<!-- Begin: Package sources from dotnet-runtime -->
1821
<add key="darc-pub-dotnet-runtime-919e5b2" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-919e5b2b/nuget/v3/index.json" />
1922
<!-- End: Package sources from dotnet-runtime -->
20-
<!-- <add key="local" value="artifacts" /> -->
23+
<add key="local" value="LOCAL_PLACEHOLDER" />
24+
<add key="nuget-only" value="NUGET_ONLY_PLACEHOLDER" />
2125
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" protocolVersion="3" />
2226
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" protocolVersion="3" />
2327
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
@@ -26,9 +30,20 @@
2630
<add key="dotnet8-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json" />
2731
<add key="dotnet9" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
2832
<add key="dotnet9-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9-transport/nuget/v3/index.json" />
33+
<add key="skiasharp" value="https://pkgs.dev.azure.com/xamarin/public/_packaging/SkiaSharp/nuget/v3/index.json" />
2934
</packageSources>
35+
3036
<activePackageSource>
3137
<add key="All" value="(Aggregate source)" />
3238
</activePackageSource>
33-
<disabledPackageSources />
39+
40+
<disabledPackageSources>
41+
<add key="local" value="true" />
42+
<add key="nuget-only" value="true" />
43+
</disabledPackageSources>
44+
45+
<!-- Define mappings by adding package patterns beneath the target source. -->
46+
<!-- Some packages will restore from different locations, but most will be from `dotnet-public`. -->
47+
<!-- The key value for <packageSource> should match key values from <packageSources> element. -->
48+
3449
</configuration>

eng/cake/dotnet.cake

+8-13
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var NuGetOnlyPackages = new string[] {
2828
"Microsoft.Maui.Essentials.*.{nupkg,snupkg}",
2929
"Microsoft.Maui.Graphics.*.{nupkg,snupkg}",
3030
"Microsoft.Maui.Maps.*.{nupkg,snupkg}",
31+
"Microsoft.Maui.Resizetizer.*.{nupkg,snupkg}",
3132
"Microsoft.AspNetCore.Components.WebView.*.{nupkg,snupkg}",
3233
};
3334
public enum RuntimeVariant
@@ -55,10 +56,8 @@ Task("dotnet")
5556
{
5657
EnsureDirectoryExists(nugetSource);
5758
var originalNuget = File("./NuGet.config");
58-
ReplaceTextInFiles(
59-
originalNuget,
60-
$"<!-- <add key=\"local\" value=\"artifacts\" /> -->",
61-
$"<add key=\"nuget-only\" value=\"{nugetSource}\" />");
59+
ReplaceTextInFiles(originalNuget, "<add key=\"nuget-only\" value=\"true\" />", "");
60+
ReplaceTextInFiles(originalNuget, "NUGET_ONLY_PLACEHOLDER", nugetSource);
6261
}
6362

6463
DotNetBuild("./src/DotNet/DotNet.csproj", new DotNetBuildSettings
@@ -295,10 +294,8 @@ Task("dotnet-pack-maui")
295294
{
296295
EnsureDirectoryExists(nugetSource);
297296
var originalNuget = File("./NuGet.config");
298-
ReplaceTextInFiles(
299-
originalNuget,
300-
$"<!-- <add key=\"local\" value=\"artifacts\" /> -->",
301-
$"<add key=\"local\" value=\"{nugetSource}\" />");
297+
ReplaceTextInFiles(originalNuget, "<add key=\"local\" value=\"true\" />", "");
298+
ReplaceTextInFiles(originalNuget, "LOCAL_PLACEHOLDER", nugetSource);
302299
}
303300

304301
var sln = "./Microsoft.Maui.Packages.slnf";
@@ -332,7 +329,7 @@ Task("dotnet-pack-additional")
332329
Version = nativeAssetsVersion,
333330
ExcludeVersion = true,
334331
OutputDirectory = assetsDir,
335-
Source = new[] { "https://aka.ms/skiasharp-eap/index.json" },
332+
Source = new[] { "https://pkgs.dev.azure.com/xamarin/public/_packaging/SkiaSharp/nuget/v3/index.json" },
336333
});
337334
foreach (var nupkg in GetFiles($"{assetsDir}/**/*.nupkg"))
338335
DeleteFile(nupkg);
@@ -838,10 +835,8 @@ DirectoryPath PrepareSeparateBuildContext(string dirName, string props = null, s
838835
}
839836

840837
// Add a specific folder for nuget-only packages
841-
ReplaceTextInFiles(
842-
config.FullPath,
843-
$"<!-- <add key=\"local\" value=\"artifacts\" /> -->",
844-
$"<add key=\"nuget-only\" value=\"{nugetOnly.FullPath}\" />");
838+
ReplaceTextInFiles(config.FullPath, "<add key=\"nuget-only\" value=\"true\" />", "");
839+
ReplaceTextInFiles(config.FullPath, "NUGET_ONLY_PLACEHOLDER", nugetOnly.FullPath);
845840

846841
// Create empty or copy test Directory.Build.props/targets
847842
if (string.IsNullOrEmpty(props))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version = "1.0" encoding = "UTF-8" ?>
2+
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
xmlns:local="clr-namespace:Maui.Controls.Sample"
5+
x:Class="Maui.Controls.Sample.App">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
10+
</ResourceDictionary.MergedDictionaries>
11+
</ResourceDictionary>
12+
</Application.Resources>
13+
</Application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace Maui.Controls.Sample;
2+
3+
public partial class App : Application
4+
{
5+
public App()
6+
{
7+
InitializeComponent();
8+
}
9+
10+
protected override Window CreateWindow(IActivationState? activationState)
11+
{
12+
// To test shell scenarios, change this to true
13+
bool useShell = false;
14+
15+
if (!useShell)
16+
{
17+
return new Window(new NavigationPage(new MainPage()));
18+
}
19+
else
20+
{
21+
return new Window(new SandboxShell());
22+
}
23+
}
24+
}

src/Controls/samples/Controls.Sample.Sandbox/MainPage.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
44
x:Class="Maui.Controls.Sample.MainPage"
55
xmlns:local="clr-namespace:Maui.Controls.Sample">
6+
67
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
using System;
2-
using System.Collections.ObjectModel;
3-
using System.Diagnostics;
4-
using Microsoft.Extensions.DependencyInjection;
5-
using Microsoft.Maui;
6-
using Microsoft.Maui.Controls;
7-
using Microsoft.Maui.Graphics;
1+
namespace Maui.Controls.Sample;
82

9-
namespace Maui.Controls.Sample
3+
public partial class MainPage : ContentPage
104
{
11-
public partial class MainPage : ContentPage
5+
public MainPage()
126
{
13-
public MainPage()
14-
{
15-
InitializeComponent();
16-
}
7+
InitializeComponent();
178
}
18-
}
9+
}

src/Controls/samples/Controls.Sample.Sandbox/Maui.Controls.Sample.Sandbox.csproj

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<SingleProject>true</SingleProject>
77
<Nullable>enable</Nullable>
88
<IsPackable>false</IsPackable>
9+
<ImplicitUsings>enable</ImplicitUsings>
10+
<Nullable>enable</Nullable>
911
<!-- Disable multi-RID builds to workaround a parallel build issue -->
1012
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
1113
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst')) and '$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)' == 'arm64'">maccatalyst-arm64</RuntimeIdentifier>
@@ -43,6 +45,8 @@
4345
<MauiImage Update="Resources\Images\dotnet_bot.svg" Color="#FFFFFF" BaseSize="168,208" />
4446
<MauiImage Include="Resources\AppIcons\appicon.svg" ForegroundFile="Resources\AppIcons\appicon_foreground.svg" IsAppIcon="true" />
4547
<MauiSplashScreen Include="Resources\Splash\splash.svg" Color="#FFFFFF" BaseSize="168,208" />
48+
<MauiFont Include="Resources\Fonts\*" />
49+
<MauiAsset Include="Resources\Raw\**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" />
4650
</ItemGroup>
4751

4852
<Import Project="$(MauiSrcDirectory)Maui.InTree.props" Condition=" '$(UseMaui)' != 'true' " />
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,26 @@
1-
using Microsoft.Maui;
2-
using Microsoft.Maui.Controls;
3-
using Microsoft.Maui.Controls.Hosting;
4-
using Microsoft.Maui.Hosting;
1+
namespace Maui.Controls.Sample;
52

6-
namespace Maui.Controls.Sample
3+
public static class MauiProgram
74
{
8-
public static class MauiProgram
9-
{
10-
public static MauiApp CreateMauiApp() =>
11-
MauiApp
12-
.CreateBuilder()
5+
public static MauiApp CreateMauiApp() =>
6+
MauiApp
7+
.CreateBuilder()
138
#if __ANDROID__ || __IOS__
14-
.UseMauiMaps()
9+
.UseMauiMaps()
1510
#endif
16-
.UseMauiApp<App>()
17-
.Build();
18-
}
19-
20-
class App : Application
21-
{
22-
protected override Window CreateWindow(IActivationState? activationState)
23-
{
24-
// To test shell scenarios, change this to true
25-
bool useShell = false;
26-
27-
if (!useShell)
28-
{
29-
return new Window(new NavigationPage(new MainPage()));
30-
}
31-
else
11+
.UseMauiApp<App>()
12+
.ConfigureFonts(fonts =>
3213
{
33-
return new Window(new SandboxShell());
34-
}
35-
}
36-
}
37-
}
14+
fonts.AddFont("Dokdo-Regular.ttf", "Dokdo");
15+
fonts.AddFont("LobsterTwo-Regular.ttf", "Lobster Two");
16+
fonts.AddFont("LobsterTwo-Bold.ttf", "Lobster Two Bold");
17+
fonts.AddFont("LobsterTwo-Italic.ttf", "Lobster Two Italic");
18+
fonts.AddFont("LobsterTwo-BoldItalic.ttf", "Lobster Two BoldItalic");
19+
fonts.AddFont("ionicons.ttf", "Ionicons");
20+
fonts.AddFont("SegoeUI.ttf", "Segoe UI");
21+
fonts.AddFont("SegoeUI-Bold.ttf", "Segoe UI Bold");
22+
fonts.AddFont("SegoeUI-Italic.ttf", "Segoe UI Italic");
23+
fonts.AddFont("SegoeUI-Bold-Italic.ttf", "Segoe UI Bold Italic");
24+
})
25+
.Build();
26+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is a raw MauiAsset file.
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
using System;
2-
using System.Collections.ObjectModel;
3-
using System.Diagnostics;
4-
using Microsoft.Extensions.DependencyInjection;
5-
using Microsoft.Maui;
6-
using Microsoft.Maui.Controls;
1+
namespace Maui.Controls.Sample;
72

8-
namespace Maui.Controls.Sample
3+
public partial class SandboxShell : Shell
94
{
10-
public partial class SandboxShell : Shell
5+
public SandboxShell()
116
{
12-
public SandboxShell()
13-
{
14-
InitializeComponent();
15-
}
7+
InitializeComponent();
168
}
17-
}
9+
}

src/Controls/src/Core/Border/Border.cs

+2-7
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,10 @@ void NotifyStrokeShapeChanges()
6464

6565
if (strokeShape is VisualElement visualElement)
6666
{
67-
SetInheritedBindingContext(visualElement, BindingContext);
67+
AddLogicalChild(visualElement);
6868
_strokeShapeChanged ??= (sender, e) => OnPropertyChanged(nameof(StrokeShape));
6969
_strokeShapeProxy ??= new();
7070
_strokeShapeProxy.Subscribe(visualElement, _strokeShapeChanged);
71-
72-
OnParentResourcesChanged(this.GetMergedResources());
73-
((IElementDefinition)this).AddResourcesChangedListener(visualElement.OnParentResourcesChanged);
7471
}
7572
}
7673

@@ -80,9 +77,7 @@ void StopNotifyingStrokeShapeChanges()
8077

8178
if (strokeShape is VisualElement visualElement)
8279
{
83-
((IElementDefinition)this).RemoveResourcesChangedListener(visualElement.OnParentResourcesChanged);
84-
85-
SetInheritedBindingContext(visualElement, null);
80+
RemoveLogicalChild(visualElement);
8681
_strokeShapeProxy?.Unsubscribe();
8782
}
8883
}

src/Controls/src/Core/Interactivity/EventTrigger.cs

+12-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ namespace Microsoft.Maui.Controls
1212
[ContentProperty("Actions")]
1313
public sealed class EventTrigger : TriggerBase
1414
{
15-
readonly List<BindableObject> _associatedObjects = new List<BindableObject>();
15+
static readonly MethodInfo s_handlerinfo = typeof(EventTrigger).GetRuntimeMethods().Single(mi => mi.Name == "OnEventTriggered" && mi.IsPublic == false);
16+
readonly List<WeakReference<BindableObject>> _associatedObjects = new List<WeakReference<BindableObject>>();
1617

1718
EventInfo _eventinfo;
1819

@@ -49,13 +50,20 @@ internal override void OnAttachedTo(BindableObject bindable)
4950
base.OnAttachedTo(bindable);
5051
if (!string.IsNullOrEmpty(Event))
5152
AttachHandlerTo(bindable);
52-
_associatedObjects.Add(bindable);
53+
_associatedObjects.Add(new WeakReference<BindableObject>(bindable));
5354
}
5455

5556
internal override void OnDetachingFrom(BindableObject bindable)
5657
{
57-
_associatedObjects.Remove(bindable);
58-
DetachHandlerFrom(bindable);
58+
_associatedObjects.RemoveAll(wr =>
59+
{
60+
if (wr.TryGetTarget(out var target) && target == bindable)
61+
{
62+
DetachHandlerFrom(bindable);
63+
return true;
64+
}
65+
return false;
66+
});
5967
base.OnDetachingFrom(bindable);
6068
}
6169

0 commit comments

Comments
 (0)