Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Attempt to fix UWP target regression #1238

Closed
wants to merge 5 commits into from

Conversation

jfversluis
Copy link
Member

Description of Change

TBD

Bugs Fixed

  • Fixes #

API Changes

Behavioral Changes

PR Checklist

  • Has a linked Issue, and the Issue has been approved
  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of main at time of PR
  • Changes adhere to coding standard

@jfversluis jfversluis added DO-NOT-MERGE Don't merge it.... don't do it! Really... UWP UWP platform issue. labels Apr 26, 2021
@inforithmics
Copy link
Contributor

Would it work when the Property would be retrieved by reflection FlyoutPresenter.IsDefaultShadowEnabledProperty

const string isDefaultShadowEnabledProperty = "IsDefaultShadowEnabledProperty";

if (ApiInformation.IsPropertyPresent(typeof(FlyoutPresenter).FullName, isDefaultShadowEnabledProperty))
{
	var property = typeof(FlyoutPresenter).GetProperty(isDefaultShadowEnabledProperty, BindingFlags.Static | BindingFlags.Public);
	if (property?.GetValue(null) is DependencyProperty enabledProperty)
	{
		flyoutStyle.Setters.Add(new Windows.UI.Xaml.Setter(enabledProperty,false));
	}
}

I tested it and it seems to work.

then it could target 1809 and work.

@jfversluis
Copy link
Member Author

jfversluis commented Apr 29, 2021

Hey @inforithmics could you please try the NuGet I reference in this comment to see if this change fixes it too? I think it does kind of the same thing, but different :)

Edit: I see this code is also in your PR, did you verify it works?

@inforithmics
Copy link
Contributor

inforithmics commented Apr 29, 2021

I tested it and the problem ist still, that the MinVersion for the nuget packages is Windows 2004 / 19041

Maybe I should elaborate a little bit more about the problem.
My UWP Xamarin.Forms project has the following settings.

image

This means that it looks for uap10.0.17763 in the nuget. (The Minimum Version and not the target Version which is uap10.0.19041).

Your pull request nuget package

image

Here it takes the the .netstandard2.0 package (which doesn't have the UWP Renderer and functionality in it).

My pull request nuget package.

image

Here it finds the uap10.0.17763 target.

For a fast test i added following line.

This compiles with my package but doesn't with yours.

var test = new Xamarin.CommunityToolkit.UWP.Effects.LifeCycleEffectRouter();

This is a type that is only avaible in the uwp target.

So the problem is that unlike android and ios the nuget target is taken from the min version not the target version that's where the problems with targeting a min version of 1809 stem from. And I don't think this could be changed fast.

So I added following change into my pull request in the project file.

from:

<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);uap10.0.19041;netcoreapp3.1;net472;net471</TargetFrameworks>

to:

 <TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">$(TargetFrameworks);uap10.0.17763;netcoreapp3.1;net472;net471</TargetFrameworks>
    <TargetPlatformVersion Condition="'$(TargetFramework)' == 'uap10.0.17763'">10.0.19041.0</TargetPlatformVersion>   

So what does this, it sets the Min Target to 1809 / 17763 But sets the Target Version to 2004 / 19041.
This isn't something I invented but i copied it from the Xamarin.Forms project.

Here is how the Xamarin.forms nuget package looks like

image

Here there a several uap targets. This would be although a possibility to Target several uap targets.
1809 / 17763
2004 / 10.0.19041

Someone already tried it once, but there where some errors / maybe I could make a different pull request with the multi targeting.

@inforithmics
Copy link
Contributor

inforithmics commented Apr 29, 2021

Here a pull request against main with Multi targeting 1809 and 2004

#1247

nuget package

https://dev.azure.com/xamarin/public/_build/results?buildId=39456&view=artifacts&pathAsName=false&type=publishedArtifacts

@inforithmics
Copy link
Contributor

Seems to have worked there are now 2 Targets

image

The only caveat in Windows 1809 is that in the Popup transparent background won't work.
In Windows 2004 everything works as before.

@inforithmics
Copy link
Contributor

inforithmics commented Apr 29, 2021

I tested the package and I discovered strange things.

  1. When I reference the nuget package it takes with Min Version 1809 the .net standard Version if I target 2004 it takes the 2004 version.
  2. When I directly reference the dll it works. I think there is some nuget/msuild strangenes going on.

@inforithmics
Copy link
Contributor

inforithmics commented Apr 29, 2021

I found out what the problem was I targeted 1903 instead of 1809 (Version mixup)

here the updated nuget:
https://dev.azure.com/xamarin/public/_build/results?buildId=39464&view=artifacts&pathAsName=false&type=publishedArtifacts

@jfversluis jfversluis closed this May 14, 2021
@jfversluis jfversluis reopened this Jun 18, 2021
@jfversluis jfversluis closed this Jun 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
DO-NOT-MERGE Don't merge it.... don't do it! Really... UWP UWP platform issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants