string email = "[email protected]";
await Device.InvokeOnMainThreadAsync(() => Launcher.TryOpenAsync($"mailto:{email}"));
No exception is beign thrown
Exception System.InvalidOperationException with message _'A method was called at an unexpected time.'_ is thrown

I am unable to reproduce this with your code. can you please provide a sample.
Go to TrackerViewModel.MailTo(object obj) to see the command executed (or place breakpoint). Execute command by launching the application and pressing the button _"Open email uri"_
Executed code on button press:
private async void MailTo(object obj)
{
string email = "[email protected]";
await Device.InvokeOnMainThreadAsync(() => Xamarin.Essentials.Launcher.TryOpenAsync($"mailto:{email}"));
}
.csproj
<TargetPlatformVersion>10.0.18362.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
.
.
.
<PackageReference Include="Xamarin.Forms" Version="4.5.0.356" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.9" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.1" />
I was able to reproduce your issue.
Calling "OpenAsync" works fine, however "TryOpenAsync" does not.
Workaround:'
private async void MailTo(object obj)
{
string email = "[email protected]";
if (await Xamarin.Essentials.Launcher.CanOpenAsync("mailto:"))
await Xamarin.Essentials.Launcher.OpenAsync($"mailto:{email}");
}
You do not need to invoke on the main thread as it is coming from a command in which it already is on the main thread :)
Hmmm strange. it only seems to be an issue when targeting newer versions of UWP which is why we didn't catch it.
You do not need to invoke on the main thread as it is coming from a command in which it already is on the main thread :)
Thank you, I'm aware of that, but in order to try fixing this error, I tried various approaches.
Nevertheless, thanks for suggesting the workaround.
Workaround with subject and body (unfortionatly only plaintext on android possible). This opens less non-email related apps to send an email (if using e.g. Email.ComposeAsync(...) )
if (await Launcher.CanOpenAsync(new Uri("mailto:")))
{
await Launcher.OpenAsync($"mailto:{emailTo}?subject={subject}&body={body}");
}
else
{
await Email.ComposeAsync(subject, body, new []{ emailTo });
}
Fixed in #1171