Forum Xamarin.iOS

Plagued by "Could not find file [cache file path]" errors

paldrichpaldrich Member ✭✭

It seems I always run into some kind of error when attempting to build one of my Xamarin.iOS projects. This time, it's the "could not find file" one:

System.IO.FileNotFoundException: Could not find file "/Users/paulaldrich/Library/Caches/Xamarin/mtbs/builds/Archerisms.iOS.Stickers/e924fafed92fde1093edcef4a61f8248/obj/iPhone/Release/actool/bundle/iMessage App [email protected]"
File name: '/Users/paulaldrich/Library/Caches/Xamarin/mtbs/builds/Archerisms.iOS.Stickers/e924fafed92fde1093edcef4a61f8248/obj/iPhone/Release/actool/bundle/iMessage App [email protected]'
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00259] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:274 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/mono-x64/mcs/class/corlib/System.IO/FileStream.cs:106 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions)
  at System.IO.FileSystem.CopyFile (System.String sourceFullPath, System.String destFullPath, System.Boolean overwrite) [0x00025] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/FileSystem.Unix.cs:54 
  at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, System.Boolean overwrite) [0x00056] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-06/external/bockbuild/builds/mono-x64/external/corefx/src/System.IO.FileSystem/src/System/IO/File.cs:74 
  at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile (System.String source, System.String target, System.String targetItemSpec) [0x0002d] in <2ef81566f3634b72b10e6ec47e856fbc>:0 
  at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute () [0x000b6] in <2ef81566f3634b72b10e6ec47e856fbc>:0    Archerisms.iOS.Stickers         

The file referenced does not exist in my project anywhere, it only exists in the obj folder under my iOS extension app (Archerisms.iOS.Stickers). I've deleted this folder multiple times, so one thing I'd like to know is, where is this file coming from? Even AgentRansack found no other references of this filename anywhere in my project.

I've seen this error before, and usually deleting the guid-named folder (e924fafed92fde1093edcef4a61f8248) fixes it, but not anymore. If I delete this folder, close VS, delete the bin and obj folders for both my main iOS app AND my iOS extension app, then re-open VS and build the main app again (in RELEASE mode), I get the same error. I've tried restarting my computer, restarting VS multiple times, reloading the iOS projects multiple times, nothing fixes it. This is why I'm starting to hate Xamarin. :/

Best Answer

  • paldrichpaldrich Member ✭✭
    Accepted Answer

    Thank you for your response LandLu. After further troubleshooting we diagnosed the issue was a corrupted image - namely, this mystery file [email protected]. Our guess is, because it was corrupted, Xamarin/actool marked it as missing. We recreated all the images and this partially resolved things; there was also a problem with us using the Assets.xcassets catalog interface, which we ditched altogether and just made sure to manually update our Contents.json and .csproj to make sure all assets were included and were the right size.

    It should be noted we were on an older version of Xamarin.iOS, which we believe caused glitches to occur with the Asset catalog. We weren't able to upgrade as doing so caused more build issues.

Answers

  • LandLuLandLu Member, Xamarin Team Xamurai

    Try to check your extension app's info.plist if it has used some icon keys.
    If this issue persists after totally cleaning up and rebooting both Mac and Windows try to open a support ticket here:
    https://support.microsoft.com/en-us/supportforbusiness/productselection?sapId=211dd84f-3474-c3c5-79bf-66db630c92a6
    Upload your project there to help us reproduce your issues. And notice that Microsoft promised to protect the user's private information.

  • paldrichpaldrich Member ✭✭
    Accepted Answer

    Thank you for your response LandLu. After further troubleshooting we diagnosed the issue was a corrupted image - namely, this mystery file [email protected]. Our guess is, because it was corrupted, Xamarin/actool marked it as missing. We recreated all the images and this partially resolved things; there was also a problem with us using the Assets.xcassets catalog interface, which we ditched altogether and just made sure to manually update our Contents.json and .csproj to make sure all assets were included and were the right size.

    It should be noted we were on an older version of Xamarin.iOS, which we believe caused glitches to occur with the Asset catalog. We weren't able to upgrade as doing so caused more build issues.

  • smartboytksmartboytk SLMember ✭✭
    edited March 26

    I had a similar problem and came across this solution:
    Add the following to my application, csproj (eg. Qbiz.Android.csproj) BEFORE the tag </Project> located at the bottom of your csproj file.

    <Target Name="_RemoveMdbFiles" BeforeTargets="_Upload">
    <ItemGroup>
    <_Temp Include="%(_ResolvedSymbols.Identity)" Condition="'%(_ResolvedSymbols.Extension)' == '.mdb'" />
    <_ResolvedSymbols Remove="@(_Temp)"/>
    </ItemGroup>
    </Target>
    

    Now it works perfectly. I believe and RECOMMEND that Xamarin or Microsoft add this line by default especially after upgrading to .netstandard 2.1 and setting Compile Using Android 10 (Q) in Android Project Setting which by the way is required for the latest Xamarin.Forms NuGet library and other recent libraries as well.

    Hope this helps

Sign In or Register to comment.