Skip to content

Commit

Permalink
Merge pull request #6740 from unoplatform/dev/jela/17-0-pre3-fixes
Browse files Browse the repository at this point in the history
VS 17.0 Preview 3 fixes
  • Loading branch information
mergify[bot] authored Aug 13, 2021
2 parents f1cdbe1 + 12d9a2b commit 54ad32f
Show file tree
Hide file tree
Showing 28 changed files with 90 additions and 33 deletions.
10 changes: 5 additions & 5 deletions build/uno.winui.single-project.targets
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@

<ItemGroup Condition=" '$(SingleProject)' == 'true' ">
<ProjectCapability Include="MauiSingleProject" />

<ProjectCapability Include="LaunchProfiles" />

<!-- Optional - Enables a list of TFM's and device categories in the debug menu -->
<!-- This allows easily toggling of debug target TFM by selecting the platform -->
<!-- If removed, Top level debug targets show as a list of devices for the selected TFM -->
<ProjectCapability Include="XamarinStaticLaunchProfiles" />
<!-- If VS is older than Dev17 -->
<ProjectCapability Include="XamarinStaticLaunchProfiles" Condition=" '$(VisualStudioVersion)' != '' and '$(VisualStudioVersion)' &lt; '17.0' " />
<!-- Otherwise define LaunchProfilesGroupByPlatformFilters by default -->
<ProjectCapability Include="LaunchProfilesGroupByPlatformFilters" Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &gt;= '17.0' " />
</ItemGroup>


Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<UNO_UWP_BUILD>true</UNO_UWP_BUILD>
<DefineConstants Condition="'$(UNO_UWP_BUILD)'!='true'">$(DefineConstants);HAS_UNO_WINUI</DefineConstants>

<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

namespace Windows.Foundation.Collections
{
#if !NET6_0_OR_GREATER // moved to linker file
#if __IOS__
[global::Foundation.Preserve(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.Preserve(AllMembers = true)]
#endif
#endif
internal class ObservableVectorEnumerableWrapper : ObservableVectorWrapper, IObservableVector<object>
{
Expand Down
2 changes: 2 additions & 0 deletions src/Uno.Foundation/Collections/ObservableVectorListWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

namespace Windows.Foundation.Collections
{
#if !NET6_0_OR_GREATER // moved to linker file
#if __IOS__
[global::Foundation.Preserve(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.Preserve(AllMembers = true)]
#endif
#endif
internal class ObservableVectorListWrapper : ObservableVectorWrapper, IObservableVector<object>
{
Expand Down
2 changes: 2 additions & 0 deletions src/Uno.Foundation/Collections/ObservableVectorWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@

namespace Windows.Foundation.Collections
{
#if !NET6_0_OR_GREATER // moved to linker file
#if __IOS__
[global::Foundation.Preserve(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.Preserve(AllMembers = true)]
#endif
#endif
internal class ObservableVectorWrapper
{
Expand Down
7 changes: 7 additions & 0 deletions src/Uno.Foundation/LinkerDefinition.net6.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<linker>
<assembly fullname="Uno.Foundation">
<type fullname="Windows.Foundation.Collections.ObservableVectorListWrapper" />
<type fullname="Windows.Foundation.Collections.ObservableVectorListWrapper" />
<type fullname="Windows.Foundation.Collections.ObservableVectorWrapper" />
</assembly>
</linker>
6 changes: 6 additions & 0 deletions src/Uno.Foundation/Uno.Foundation.net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
<PackageReference Include="Uno.Diagnostics.Eventing" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="LinkerDefinition.net6.xml">
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>

<ItemGroup Condition="$(_IsNetStd) or $(_IsNet)">
<PackageReference Include="System.Memory" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/Uno.UI.Toolkit/CommandBarExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@

namespace Uno.UI.Toolkit
{
#if !NET6_0_OR_GREATER // Moved to the linker definition file
#if __IOS__
[global::Foundation.PreserveAttribute(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.PreserveAttribute(AllMembers = true)]
#endif
#endif
public static class CommandBarExtensions
{
Expand Down
9 changes: 9 additions & 0 deletions src/Uno.UI.Toolkit/LinkerDefinition.net6.0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<linker>
<assembly fullname="Uno.UI.Toolkit">
<type fullname="Uno.UI.Toolkit.CommandBarExtensions"/>
<type fullname="Uno.UI.Toolkit.MenuFlyoutItemExtensions"/>
<type fullname="Uno.UI.Toolkit.UIElementExtensions"/>
<type fullname="Uno.UI.Toolkit.MenuFlyoutExtensions"/>
<type fullname="Uno.UI.Toolkit.SplitViewExtensions"/>
</assembly>
</linker>
6 changes: 4 additions & 2 deletions src/Uno.UI.Toolkit/MenuFlyoutExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@

namespace Uno.UI.Toolkit
{
#if !NET6_0_OR_GREATER // Moved to the linker definition file
#if __IOS__
[global::Foundation.PreserveAttribute(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.PreserveAttribute(AllMembers = true)]
#endif
#endif
public class MenuFlyoutExtensions
{
#region Property: CancelTextIosOverride
#region Property: CancelTextIosOverride

public static DependencyProperty CancelTextIosOverrideProperty { get; } = DependencyProperty.RegisterAttached(
"CancelTextIosOverride",
Expand All @@ -24,6 +26,6 @@ public class MenuFlyoutExtensions
public static string GetCancelTextIosOverride(MenuFlyout obj) => (string)obj.GetValue(CancelTextIosOverrideProperty);

public static void SetCancelTextIosOverride(MenuFlyout obj, string value) => obj.SetValue(CancelTextIosOverrideProperty, value);
#endregion
#endregion
}
}
6 changes: 4 additions & 2 deletions src/Uno.UI.Toolkit/MenuFlyoutItemExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

namespace Uno.UI.Toolkit
{
#if !NET6_0_OR_GREATER // Moved to the linker definition file
#if __IOS__
[global::Foundation.PreserveAttribute(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.PreserveAttribute(AllMembers = true)]
#endif
#endif
public static class MenuFlyoutItemExtensions
{
#region IsDestructive
#region IsDestructive

public static DependencyProperty IsDestructiveProperty { get; } =
DependencyProperty.RegisterAttached(
Expand All @@ -35,6 +37,6 @@ public static bool GetIsDestructive(this MenuFlyoutItem menuFlyoutItem)
return (bool)menuFlyoutItem.GetValue(IsDestructiveProperty);
}

#endregion
#endregion
}
}
6 changes: 4 additions & 2 deletions src/Uno.UI.Toolkit/SplitViewExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@

namespace Uno.UI.Toolkit
{
#if !NET6_0_OR_GREATER // Moved to the linker definition file
#if __IOS__
[global::Foundation.PreserveAttribute(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.PreserveAttribute(AllMembers = true)]
#endif
#endif
public static class SplitViewExtensions
{
#region IsPaneEnabled
#region IsPaneEnabled

public static DependencyProperty IsPaneEnabledProperty { get; } =
DependencyProperty.RegisterAttached(
Expand All @@ -35,6 +37,6 @@ public static bool GetIsPaneEnabled(this SplitView splitView)
return (bool)splitView.GetValue(IsPaneEnabledProperty);
}

#endregion
#endregion
}
}
2 changes: 2 additions & 0 deletions src/Uno.UI.Toolkit/UIElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@

namespace Uno.UI.Toolkit
{
#if !NET6_0_OR_GREATER // Moved to the linker definition file
#if __IOS__
[global::Foundation.PreserveAttribute(AllMembers = true)]
#elif __ANDROID__
[Android.Runtime.PreserveAttribute(AllMembers = true)]
#endif
#endif
public static class UIElementExtensions
{
Expand Down
11 changes: 6 additions & 5 deletions src/Uno.UI.Toolkit/Uno.UI.Toolkit.net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@
<PackageReference Include="Uno.Core.Build" />
</ItemGroup>

<ItemGroup Condition=" $(IsMonoAndroid) or $(IsXamarinIOS) or $(IsXamarinMac) ">
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Uno.UI\Uno.UI.net6.csproj">
<Name>Uno.UI</Name>
Expand All @@ -73,6 +68,12 @@
<Page Include="Themes\Generic.xaml" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="LinkerDefinition.net6.0.xml">
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
</ItemGroup>

<Import Project="..\SourceGenerators\Uno.UI.SourceGenerators\Content\Uno.UI.SourceGenerators.props" />
<Import Project="..\Common.targets" />

Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/BaseActivity.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public override void AddContentView(View view, ViewGroup.LayoutParams @params)

partial void InnerCreate(Android.OS.Bundle bundle) => SetAsCurrent();

partial void InnerCreateWithPersistedState(Android.OS.Bundle bundle, PersistableBundle persistentState) => SetAsCurrent();
partial void InnerCreateWithPersistedState(Bundle savedInstanceState, PersistableBundle persistentState) => SetAsCurrent();

partial void InnerStart()
{
Expand Down
10 changes: 10 additions & 0 deletions src/Uno.UI/LinkerDefinition.net6.0-android.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<linker>
<assembly fullname="Uno.UI">
<type fullname="Windows.UI.Xaml.ApplicationActivity">
<method name="GetTypeAssemblyFullName" />
</type>
<type fullname="Windows.UI.Xaml.NativeApplication">
<method name="GetTypeAssemblyFullName" />
</type>
</assembly>
</linker>
2 changes: 2 additions & 0 deletions src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ protected override void OnActivityResult(int requestCode, Result resultCode, Int
/// </summary>
/// <param name="type">A type full name</param>
/// <returns>The assembly that contains the specified type</returns>
#if !NET6_0_OR_GREATER
[Android.Runtime.Preserve]
#endif
[Java.Interop.Export]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public static string GetTypeAssemblyFullName(string type) => Type.GetType(type)?.Assembly.FullName;
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/Flyout/FlyoutBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ protected internal virtual void Open()
_popup.IsOpen = true;
}

partial void SetPopupPositionPartial(UIElement placementTarget, Point? absolutePosition);
partial void SetPopupPositionPartial(UIElement placementTarget, Point? positionInTarget);

partial void OnDataContextChangedPartial(DependencyPropertyChangedEventArgs e)
{
Expand Down
12 changes: 6 additions & 6 deletions src/Uno.UI/UI/Xaml/Controls/ListViewBase/ListViewBase.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,17 @@ partial void AddGroupItems(int groupIndex)
}
}

partial void RemoveGroupItems(int groupIndex, int count)
partial void RemoveGroupItems(int groupIndex, int groupCount)
{
var adapter = NativePanel?.CurrentAdapter;
if (adapter == null)
{
return;
}

if (count > 0)
if (groupCount > 0)
{
adapter.NotifyItemRangeRemoved(GetDisplayIndexFromIndexPath(Uno.UI.IndexPath.FromRowSection(0, groupIndex)), count);
adapter.NotifyItemRangeRemoved(GetDisplayIndexFromIndexPath(Uno.UI.IndexPath.FromRowSection(0, groupIndex)), groupCount);
NativePanel?.NativeLayout?.NotifyCollectionChange(groupOperation: null);
}
}
Expand Down Expand Up @@ -182,11 +182,11 @@ internal override int IndexFromContainerInner(DependencyObject container)
return base.IndexFromContainerInner(container);
}

partial void PrepareNativeLayout(VirtualizingPanelLayout layouter)
partial void PrepareNativeLayout(VirtualizingPanelLayout layout)
{
layouter.XamlParent = this;
layout.XamlParent = this;
var disposables = new CompositeDisposable();
PropertyChangedCallback headerFooterCallback = (_, __) => layouter.UpdateHeaderAndFooter();
PropertyChangedCallback headerFooterCallback = (_, __) => layout.UpdateHeaderAndFooter();
this.RegisterDisposablePropertyChangedCallback(HeaderProperty, headerFooterCallback).DisposeWith(disposables);
this.RegisterDisposablePropertyChangedCallback(FooterProperty, headerFooterCallback).DisposeWith(disposables);
this.RegisterDisposablePropertyChangedCallback(HeaderTemplateProperty, headerFooterCallback).DisposeWith(disposables);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ public bool HasDynamicElementSizes
}
}

partial void OnAreStickyGroupHeadersEnabledChangedPartialNative(bool oldValue, bool newValue)
partial void OnAreStickyGroupHeadersEnabledChangedPartialNative(bool oldAreStickyGroupHeadersEnabled, bool newAreStickyGroupHeadersEnabled)
{
if (newValue != oldValue)
if (newAreStickyGroupHeadersEnabled != oldAreStickyGroupHeadersEnabled)
{
InvalidateLayout();
}
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/Popup/Popup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ private void OnPopupPanelChanged(PopupPanel oldHost, PopupPanel newHost)
ApplyLightDismissOverlayMode();
}

partial void OnPopupPanelChangedPartial(PopupPanel oldHost, PopupPanel newHost);
partial void OnPopupPanelChangedPartial(PopupPanel previousPanel, PopupPanel newPanel);

protected override void OnVerticalOffsetChanged(double oldVerticalOffset, double newVerticalOffset)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/ProgressRing/ProgressRing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static void OnIsActiveChanged(DependencyObject dependencyObject, Depende

partial void OnUnloadedPartial();

partial void OnIsActiveChangedPartial(bool newValue);
partial void OnIsActiveChangedPartial(bool isActive);

#if !UNO_REFERENCE_API && !__MACOS__ && !__NETSTD_REFERENCE__

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private void ApplyForeground()

partial void OnUnloadedPartial() => TrySetNativeAnimating();

partial void OnIsActiveChangedPartial(bool _) => TrySetNativeAnimating();
partial void OnIsActiveChangedPartial(bool isActive) => TrySetNativeAnimating();

partial void TrySetNativeAnimating()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/Controls/WebView/WebView.iOSmacOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@ internal void OnNavigationFailed(WebViewNavigationFailedEventArgs args)
[Obsolete("https://github.com/unoplatform/uno/pull/1591")]
public static bool MustUseWebKitWebView() => true;

partial void OnScrollEnabledChangedPartial(bool isScrollingEnabled)
partial void OnScrollEnabledChangedPartial(bool scrollingEnabled)
{
_nativeWebView.SetScrollingEnabled(isScrollingEnabled);
_nativeWebView.SetScrollingEnabled(scrollingEnabled);
}

private bool VerifyNativeWebViewAvailability()
Expand Down
2 changes: 2 additions & 0 deletions src/Uno.UI/UI/Xaml/NativeApplication.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ internal bool TryHandleIntent(Intent intent)
/// </summary>
/// <param name="type">A type full name</param>
/// <returns>The assembly that contains the specified type</returns>
#if !NET6_0_OR_GREATER
[Android.Runtime.Preserve]
#endif
[Export]
[global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
public static string GetTypeAssemblyFullName(string type) => Type.GetType(type)?.Assembly.FullName;
Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/UIElement.Pointers.iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public override void TouchesCancelled(NSSet touches, UIEvent evt)
#endregion

#region TouchesManager (Alter the parents native scroll view to make sure to receive all touches)
partial void OnManipulationModeChanged(ManipulationModes _, ManipulationModes newMode)
partial void OnManipulationModeChanged(ManipulationModes oldMode, ManipulationModes newMode)
// As we have to walk the tree and this method may be invoked too early, we don't try to track the state between the old and the new mode
=> PrepareParentTouchesManagers(newMode);

Expand Down
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/UIElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ protected virtual void OnVisibilityChanged(Visibility oldValue, Visibility newVi
}
}

partial void OnVisibilityChangedPartial(Visibility oldValue, Visibility newVisibility);
partial void OnVisibilityChangedPartial(Visibility oldValue, Visibility newValue);

[NotImplemented]
protected virtual AutomationPeer OnCreateAutomationPeer() => new AutomationPeer();
Expand Down
3 changes: 3 additions & 0 deletions src/Uno.UI/Uno.UI.net6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="LinkerDefinition.$(TargetFramework).xml" Condition="exists('LinkerDefinition.$(TargetFramework).xml')">
<LogicalName>$(AssemblyName).xml</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="Microsoft\UI\Xaml\Controls\ProgressRing\ProgressRingIntdeterminate.json" />
</ItemGroup>

Expand Down

0 comments on commit 54ad32f

Please sign in to comment.