-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
Sentry.Maui doesn't work when deploying for iOS using "Hot Restart" #1961
Comments
Thanks for reporting. I'll investigate. |
Hi, a few questions:
Also, please verify your .NET version (6.0.540 isn't out yet). Paste the result of Thanks |
Hi, thanks :)
Oops sorry i've double checked and edited the post => it's 6.0.304 |
I assume you are deploying with VS for Mac 2022 Preview using a local provisoning profile then? Or some other way? |
I wonder if somehow our native sdk didn't get linked in the app. |
If that was the case, I should be able to reproduce it easily. So far, I haven't been able to, either on simulators or on a physical device, though my devices are a bit older. I've ordered a iPhone SE 2020 for testing. I'll get back to you after I've tried on that model. |
With Pair to Mac I assume? I'll try that way and see if there's any difference. I usually deploy directly from a Mac when testing. |
Nope! Actually with Hot Restart there's no need to Pair to Mac :) Thanks for investigating! |
Wow, ok. I didn't know about this. TIL that Hot Restart and Hot Reload are not the same things. Microsoft and naming things... lol 😅 |
And here's the culprit: https://learn.microsoft.com/en-us/dotnet/maui/deployment/hot-restart#prevent-code-from-executing
It looks like I'll have to put some Of course this also means that the features of (Update: Our library is not static, so actually the statement in the docs is not applicable here. See further down for more details.) |
In the short term, if you don't need Sentry while developing locally, you could do that at initialization time. For example: public static MauiApp CreateMauiApp() =>
MauiApp.CreateBuilder()
.UseMauiApp<App>()
#if !HOTRESTART
.UseSentry(options =>
{
options.Dsn = // your dsn, etc.
})
#endif
// The remainder of your configuration
.Build();
} |
Perfect! |
Apparently the issue is more complicated than I first understood. It is also affecting MAUI packages from others, including DevExpress. See dotnet/maui#10800 We both have bindings to iOS projects via XCFramework packages, which apparently are not currently supported by Hot Restart. They contain dynamic libraries, not static libraries - so they should work, but currently they do not. The issue needs to be fixed in Hot Restart itself, by the Visual Studio team. If you could please upvote and add feedback to this issue that would help. In the meantime, I will test this out myself and also see if I can find any workaround. I can't make any promises though. Thanks for your patience. |
I've created a workaround. See dotnet/maui#10800 (comment) I haven't decided yet if I want to worm this into Sentry's nugets yet or not. In the meantime, you can add the workaround to your own csproj. |
Based on dotnet/macios#16571 (comment), I've decided we should incorporate the workaround in the |
Sorry Matt, it's still not working for me. Crashes with the same trace as before. Sample code app at https://drive.google.com/file/d/1TmkncEencVyvU_dmdX1EDFGYJClCM1yb/view?usp=share_link . Tx |
Thanks, I will continue to investigate. |
@plattski - I tried your sample app, and it worked for me. Would you please capture a binlog so I can debug further? The best way I've found that captures the hotrestart build is to install the VS Project System Tools 2022 extensions. Then go to Assuming that it fails as before, the binlog will show the path that should be invoked with the custom target. Thanks. |
Thanks so much for checking. I’ll do that first thing tomorrow.
|
Doing some more testing, I think I may have found the problem. Try changing the last line of the workaround: from <_HotRestartFrameworks Include="@(_HotRestartFrameworksFromPackages)" /> to: <_HotRestartFrameworks Include="@(_HotRestartFrameworksFromPackages -> TrimEnd('\'))" /> Please let me know if it works after that. Thanks. |
I added the workaround in #2047, with a few modifications to keep us from stepping on the full fix when merged by Microsoft. I tested locally by creating a set of private nuget packages and using them in a new MAUI project on Windows. It built and deployed with Hot Restart without failure. @plattski @legrignotin (and others) - If you want to try yourself before we release, grab this zip: Extract that zip to a folder somewhere, then add a <?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="local" value="C:\path\to\the\private\packages" />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration> Then bump the package reference in the project to match: <PackageReference Include="Sentry.Maui" Version="3.23.2-private-preview.3" /> Remove any previous workaround code from the csproj, as it's now delivered as a transitive build dependency in the It should work now via Visual Studio deploy to device with hot restart. Assuming this works for everyone else as it did for me, the fix will be in the next release - so just use the private build only to validate this. Thanks. |
This one worked for me, in the bare-bones sample that I posted, and in two
other, more functional apps. I think you've got it, at least for me, at
least for now. Tx
|
This is resolved in the latest 3.24.0 release. Thanks all! |
Package
Sentry.Maui
.NET Version
6.0.304
OS
iOS
SDK Version
3.21.0-preview.3
Steps to Reproduce
Expected Result
The application launch without any error or crash
Actual Result
The application crash.
The text was updated successfully, but these errors were encountered: