-
Notifications
You must be signed in to change notification settings - Fork 23
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
add MAUI support #85
base: master
Are you sure you want to change the base?
add MAUI support #85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There're lot's of CA1416
warnings for maccatalyst
and iOS
targets.
They might cause some runtime crashes
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks> | ||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows')) and '$(MSBuildRuntimeType)' == 'Full'">$(TargetFrameworks);net6.0-windows10.0.19041</TargetFrameworks> | ||
<UseMaui>true</UseMaui> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed (only adds unnecessary dependencies)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What part is not needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UseMaui
. You can remove it, and everything would still compile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, AFAIK without that the UWP/WinSDK is missing? I will try...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, it compiled for me when I removed UseMaui
. Maybe needed to do rebuild or something for it to fail.
Maybe that's why current MAUI template also has this in it's project file:
<ItemGroup Condition="$(TargetFramework.Contains('-windows'))">
<!-- Required - WinUI does not yet have buildTransitive for everything -->
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.0" />
<PackageReference Include="Microsoft.Graphics.Win2D" Version="1.0.0.30" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
</PropertyGroup>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, interesting - will try again on my side (incl. iOS tests) and report back...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, any news on that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, sorry - had no time lately 😑
But it's still on my list 🙈
Calendars/Calendars.Plugin.iOSUnified/CalendarsImplementation.cs
Outdated
Show resolved
Hide resolved
Calendars/Calendars.Plugin.iOSUnified/CalendarsImplementation.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Maksym Koshovyi <[email protected]>
Co-authored-by: Maksym Koshovyi <[email protected]>
Co-authored-by: Maksym Koshovyi <[email protected]>
I had some problems with my iOS test-system and did not test this build there yet - will do that ASAP and report back... |
@@ -2,26 +2,30 @@ | |||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | |||
<metadata minClientVersion="2.8.1"> | |||
<id>CClarke.Plugin.Calendars</id> | |||
<version>1.1.0</version> | |||
<version>1.2.0-preview11</version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you would think it's that easy, but I think AppVeyor will overwrite this... I'll have to look into that again if going this route
(but why the 11?) - nevermind, I see the note about MAUI Preview 11, makes sense now
@@ -456,7 +457,7 @@ public async Task<bool> DeleteCalendarAsync(Calendar calendar) | |||
throw new ArgumentException("Cannot delete calendar (probably because it's non-local)", nameof(calendar)); | |||
} | |||
|
|||
return await Task.Run(() => Delete(_calendarsUri, long.Parse(calendar.ExternalID))).ConfigureAwait(false); | |||
return await Task.Run(() => Delete(_calendarsUri, long.Parse(calendar.ExternalID ?? String.Empty))).ConfigureAwait(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, possibly this should just return false if ExternalID
is null
rather than bother to call Delete
.... but that can be out-of-scope for this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was just a "dirty fix" for a more-or-less wrong nullable-detection, as it will never get to this place if the id would be null (except maybe some race-conditions). Because existing
would be null in that case and it would return false a few lines above...
Maybe a check at the beginning of that method would make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A check at the beginning makes sense to me. And yeah I understand and agree with your reasoning but the "dirty fix" still looks a bit odd to me
Well this "MAUI" project is new and interesting... you can have a single project that targets all the platforms now? (apologies for my ignorance, although I still skim the headlines I'm not as deep in the .NET world as I used to be) Is that really a MAUI-specific thing though, or just a .NET 6 thing? I think it would be confusing if normal .NET 6 iOS/Android projects are dependent on a "MAUI" DLL. |
I will look into dropping the "MAUI" part and be "plain net6.0" as soon as I find some time to also check the iOS build on my test-phone. |
Your mention of "iOS tests" raises another question... are the Xamarin Unit Test apps even compatible with .NET 6? dotnet/android#5647 seems to suggest the answer will be "no"... says there's a "new" |
How about XHarness? |
Yes! That's one of the features. It's not MAUI specific.
|
Ah, I missed that previous comment. Interesting. It sounds potentially limiting in terms of development flow (e.g. being able to rerun/debug a single test?), but that could just be me misinterpreting the brief documentation. Worth looking into... but hopefully the existing tests can still work for now
Wow, how did I miss that. I just found https://montemagno.com/converting-xamarin-libraries-to-sdk-style-multi-targeted-projects/, which I see also talks about the nuspec thing that was confusing me...
Hmmm.... that reminds me, the challenge of updating CI config will likely come up again for this. It might be wise for me to try to tackle that before this gets merged (though that shouldn't stop it from getting to a merge-ready state)... especially if it means needing to move off of AppCenter... |
Example of MAUI CI: https://github.com/maxkoshevoi/NureTimetable/blob/maui/.github/workflows/build.yml And here's CI for regular Xamarin app: https://github.com/maxkoshevoi/NureTimetable/blob/main/.github/workflows/build.yml |
For what it's worth, I downloaded this branch and referenced it directly, and whereas I was getting the "This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation." error on iOS (I guess the NETSTANDARD1_0 check was getting activated?), everything works on maui android and iOS now. Thanks a ton! |
Proposed fix for #78
This is an "as is" port using the exact same files via links compiled against the new TFMs. I only had to make some minor changes to the original files which should not change anything in the original TFMs.