Closed espenrl closed 1 year ago
Assigning to @getsentry/support for routing, due by (sfo). ⏲️
It's reported to Microsoft at https://github.com/xamarin/xamarin-macios/issues/18259
This is related to #1961 - which I applied a workaround for in #2047.
The corresponding Microsoft issue is https://github.com/xamarin/xamarin-macios/issues/16571 - which was going to be patched by a similar approach to my workaround, but they went with a different approach for .NET 8 - see recent comment: https://github.com/xamarin/xamarin-macios/pull/16605#issuecomment-1538605649
I never ran into long file path issues, but I can see how they could occur. I'll investigate if we can update our workaround.
In the meantime, here are a couple of things you might consider:
You could enable long paths on Windows itself
~You could change the temp folder to use a shorter path. It's the HotRestartPackageResourcesDir
seen here. Change it by adding something like the following to your csproj:~
<PropertyGroup>
<HotRestartPackageResourcesDir>C:\some-directory\</HotRestartPackageResourcesDir>
</PropertyGroup>
~or you can do it on the command line with dotnet build -p:HotRestartPackageResourcesDir=C:\some-directory\
etc.~
I managed to find a workaround by editing C:\Users\xxxx\.nuget\packages\sentry.bindings.cocoa\3.31.0\lib\net6.0-ios16.1\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\Info.plist
.
I changed LibraryIdentifier
value ios-arm64_x86_64-simulator
to simulator
and renamed the folder in the same directory accordingly. That makes the path go below the required 260 characters. Barely, but it's enough. I don't really know if this affects Sentry, but at least I can get the app running (Sentry is important in production).
It doesn't seem that simulator files are even needed for hot restart.
HotRestartPackageResourcesDir
logic doesn't run as the files are not zipped inside the NuGet.
And now I finally understand why I haven't experienced this problem until now. I recently removed MacCatalyst as a build target.
In the end the paths are long, and given a longer app name than Naturoppdrag
and a longer Windows username than my four characters there is bound to be issues. The app name counts 3 times in the path.
C:\Users\xxxx
\AppData\Local\Temp\Xamarin\HotRestart\Signing\Naturoppdrag
.app\out\Payload\Naturoppdrag
.app\Naturoppdrag
.content\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\ios-arm64_x86_64-simulator\dSYMs\Sentry-iPhoneSimulator.dSYM\Contents\Resources\DWARF\Sentry
I'm glad you have a workaround, and thanks for the feedback! I'll keep this issue open so we can find a way to address it internally.
I was able to reproduce this. And you're right - it doesn't have to do with our own hot restart workaround logic.
The easiest actual workaround I can find is to enable log file paths in windows. Change the registry value mentioned, and then restart Visual Studio for it to take effect. I tested with that enabled, and it seems to resolve the problem.
I'll continue to look for a more elegant solution. Ideally, the simulator files would not be included for Hot Restart builds. But I'm not seeing an easy way to exclude them for Hot Restart and still have them available when actually running in a simulator.
I found a way to remove the simulator native resources from the Hot Restart builds. They're not needed there, and removing them avoids the max path issue. The fix is in #2384, and will be included with the next release. Thanks.
Thanks @mattjohnsonpint
This has been released with our 3.32.0 release. Thanks - and please let us know if you run into any other issues.
@mattjohnsonpint Hi there , we are evaluating Sentry as an alternative to AppCenter and we have encountered issue with long path on windows attached to a physical iOS device , so I enabled long path on windows but now I get below, bcse of this we have not been in a position to evaluate any further. Any suggestions?
Windows 11 – Visual Studio 2022 17.6.3 Sentry.Maui Version 3.33.1
Unable to remove directory "C:\Users\gb\AppData\Local\Temp\Xamarin\HotRestart\Signing\ SampleAppSentry.app\out\". Could not find a part of the path 'C:\Users\gb\AppData\Local\Temp\Xamarin\HotRestart\Signing\ SampleAppSentry.app\out\Payload\SampleAppSentry.app\SampleAppSentry.content\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\ios-arm64\dSYMs\Sentry-iPhoneOS.dSYM\Contents\Resources\DWARF'. SampleAppSentry C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7067\tools\msbuild\iOS\Xamarin.iOS.HotRestart.targets
Hey @GBrienza A wild guess: The space as part of the path is intentional?
Hi @bitsandfoxes I did not leave any space intentionally.
The SampleAppSentry.app
seems to have a leading whitespace. Could you try running without just so we can exclude that from the "might be a cause" list? Thanks!
@bitsandfoxes
Hi All I did was
Severity Code Description Project File Line Suppression State Error MSB3231 Unable to remove directory "C:\Users\usernamehere\AppData\Local\Temp\Xamarin\HotRestart\Signing\SampleAppSentry.app\out\". Could not find a part of the path 'C:\Users\usernamehere\AppData\Local\Temp\Xamarin\HotRestart\Signing\SampleAppSentry.app\out\Payload\SampleAppSentry.app\SampleAppSentry.content\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\ios-arm64\dSYMs\Sentry-iPhoneOS.dSYM\Contents\Resources\DWARF'. SampleAppSentry C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7089\tools\msbuild\iOS\Xamarin.iOS.HotRestart.targets 359
Hope is of any help
Looking at the error message:
Severity Code Description Project File Line Suppression State Error MSB3231 Unable to remove directory "C:\Users\usernamehere\AppData\Local\Temp\Xamarin\HotRestart\Signing\SampleAppSentry.app\out". Could not find a part of the path 'C:\Users\usernamehere\AppData\Local\Temp\Xamarin\HotRestart\Signing\SampleAppSentry.app\out\Payload\SampleAppSentry.app\SampleAppSentry.content\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\ios-arm64\dSYMs\Sentry-iPhoneOS.dSYM\Contents\Resources\DWARF'. SampleAppSentry C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7089\tools\msbuild\iOS\Xamarin.iOS.HotRestart.targets 359
This seems to me different than the original issue with path too long. Seems like something in the build tried to remove the path C:\Users\usernamehere\AppData\Local\Temp\Xamarin\HotRestart\Signing\SampleAppSentry.app\out\Payload\SampleAppSentry.app\SampleAppSentry.content\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\ios-arm64\dSYMs\Sentry-iPhoneOS.dSYM\Contents\Resources\DWARF
but it choked already when it got to ../out
because that didn't exist. Probably best to create a new ticket to track that problem. And close this issue again.
I've opened https://github.com/getsentry/sentry-dotnet/issues/2567. Closing this issue again then.
Environment
SaaS (https://sentry.io/)
Steps to Reproduce
Setup MAUI .NET 7 service release 6 with Sentry and deploy from Visual Studio to a usb connected IPhone.
NOTE: This is a compound issue by Sentry NuGet having files in a deep folder structure and MAUI SDK tooling generating longer paths than needed.
Expected Result
Deployment to go an without error.
Actual Result
Fails with MSB3021 The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
Severity Code Description Project File Line Suppression State Error MSB3021 Unable to copy file
"C:\Users\xxxx\.nuget\packages\sentry.bindings.cocoa\3.31.0\lib\net6.0-ios16.1\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\ios-arm64_x86_64-simulator\dSYMs\Sentry-iPhoneSimulator.dSYM\Contents\Resources\DWARF\Sentry"
to"C:\Users\xxxx\AppData\Local\Temp\Xamarin\HotRestart\Signing\Naturoppdrag.app\out\Payload\Naturoppdrag.app\Naturoppdrag.content\Sentry.Bindings.Cocoa.resources\Sentry.xcframework\ios-arm64_x86_64-simulator\dSYMs\Sentry-iPhoneSimulator.dSYM\Contents\Resources\DWARF\Sentry"
. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. Naturoppdrag C:\Program Files\dotnet\packs\Microsoft.iOS.Windows.Sdk\16.4.7054\tools\msbuild\iOS\Xamarin.iOS.HotRestart.targets 273Product Area
Other
Link
No response
DSN
No response
Version
3.31.0