iOS App crashes immediately after debug start

Marc 1 Reputation point
2021-07-08T12:59:00.453+00:00

After updating VS2019 a while back I could not debug my app anymore. After a lot of research at that time, there was a statement, that this problem should be fixed in the next VS update. Now some VS updates later I wanted to check out if the problem was fixed, but unfortunately it is not for me.

What is happening:
I can run my build succesfully and get the build message, that the application is started succesfully as well. The debugger starts, the application opens up but closes immediately after.
The console of VS and the debugger do not show any output. While the App is already closed on the device, the debugger of VS is hanging for a while until VS is back to developing mode. The only line in the debug output now is "the app was closed".

What I already tried:
-updating/consolidating all packages
-changing and renewing apple certificates
-try hitting breakpoints, but it is not even hitting the first line of iOS Main.cs
-switching of Hot Reload
-reinstall Xcode on the mac buildhost (current version: 12.5.1)
-updating/reinstall VS (current version: 16.10.03)
-creating new empty project (works fine)

strange behavior:
but the strange thing now is, I copied over the project directly to the build host and opened it there with VS for mac. Running the build directly from the mac worked like a charm. The application starts and runs without any issues.

My problem:
My main problem here is, that I do not get any usefull output on what may causes this issue. Maybe someone knows, which log I have to look for to get some helpful information or even had the same problem.
The only hint so far for me is a line from the build log:

/private/var/containers/Bundle/Application/xxxxxxxxx/xxxxxxxxx.iOS.app/libxxxxxxxxx.iOS.exe.dylib: code signature in (/private/var/containers/Bundle/Application/xxxxxxxxx/xxxxxxxxx.iOS.app/libxxxxxxxxx.iOS.exe.dylib) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.

This obviously looks like there is some problem with the signing certificates, but I am using the same signing settings as the working ones while building directly on the mac.

Thanks for your help in advance.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
{count} votes

2 answers

Sort by: Most helpful
  1. dan eller 1 Reputation point
    2021-09-03T20:39:10.463+00:00

    I'm not sure if we are talking about the same issue. I'm new at this and trying to figure things out as I go so forgive me if we are talking about totally different issues.

    I received the error " build error could not find '/var/containers/bundle/application/..."
    This happened out of the blue. I had been working on the project 2 hours prior.

    In desperation I went to build--> rebuild solution and tried to run it to no avail. Then went to build--> build solution and BAM it worked. Beats me but what a relief

    0 comments No comments

  2. Muhammad Anas Ansari 1 Reputation point
    2022-08-01T08:02:46.347+00:00

    HI. The same issue is faced by some others peoples too. For this we have to wait for the updating of the VS so may be this error have to removed. you may check for the VS version 17.2.6 in this your problem would be resolved.

    0 comments No comments