0

I'm having a problem with Xamarin.Forms, iOS on-demand resources, and Visual Studio on Windows. Every time when I try to run an application with on-demand resources and trigger a download, I see an error message retrieved from NSBundleResourceRequest.BeginAccessingResourcesAsync() with description: Error Domain=NSCocoaErrorDomain Code=4994 "The requested application data doesn’t exist.". The application is started from Visual Studio on Windows. I'm building and deploying the application from Visual Studio Enterprise 2019 to an iPhone emulator running on remote Mac Mini. Interesting is, this problem goes away when the application is built and deployed from Visual Studio for Mac, locally.

If you want to try this on your own you can use an official example about On-Demand Resources on the Xamarin platform, called iTravel. I can reproduce the same behavior with it.

Screenshot with the exception

Is this a well-known issue or is there any possible workaround on how to run/debug a Xamarin application which is using on-demand resources from Visual Studio on Windows? My solution can't be fully built on mac.

Ales Kobr
  • 31
  • 3
  • What type of resource are you trying to access? An image file? Is it in an `.xcassets` file? Or in your solution repo? – NSGangster Jan 03 '20 at 18:55
  • I’m having the same issue with single image resource and with assets catalog, as well. In that iTravel example are multiple datasets under main assets catalog which contains links to multiple images in resource folder. If you want to reproduce it try run the example from windows under VS. – Ales Kobr Jan 04 '20 at 16:19
  • I looked at the iTravel example, but I don't see how the error is not caught using the try-catch. Could you place an exception catchpoint, or step through with breakpoints to figure out the exact code snippet where the error occurs. If you share this along with the file & screenshot, that will help us fix your issue. – Saamer Jan 06 '20 at 00:45
  • Also what happens if you just use BeginAccessingResources instead of BeginAccessingResourcesAsync https://github.com/xamarin/SubmissionSamples/blob/fe02bb67ccf64ff07a6cb75b10195ef4fd1f6cec/ODRsTVOS_Extension/ODRsTVOS/ViewController.cs – Saamer Jan 06 '20 at 00:55
  • I downloaded the iTravel project and run it on my side. I did not see any error message. I use the Microsoft Visual Studio Community 2019 Version 16.4.2 and XCode 11.1. Can you please update your visual-studio for windows and check if the problem still exist? – nevermore Jan 06 '20 at 05:25
  • We are using the latest versions of VS 2019 and XCode, the same as you. It looks like it must be some environment issue, how macs or network is configured because the issue is happening on all machines, here. I thought when VS is remotely connected to iOS simulator it is the same as running in locally from VS for Mac, but apparently is not. We will investigate network traffic and I will inform you if we find the reason. Thanks, everyone for help. – Ales Kobr Jan 06 '20 at 10:53
  • Ok, once you find the solution, you can share here:). – nevermore Jan 07 '20 at 03:07
  • It looks like the problem is caused by remote simulation from Visual Studio Enterprise when this feature is disabled and simulator runs locally on Mac everything is fine. – Ales Kobr Jan 07 '20 at 10:53

0 Answers0