Bug? Crash when loading previously working layouts and files

Sandman

Expert
Licensed User
Longtime User
I have encountered a very strange problem. All of a sudden it seems that the app crashes when it loads a file. This has been verified both for layouts and a file in Files. None of these files have been modified recently and have previously worked just fine.

I was curious what had happened, in what way that were corrupted. So I took a look at them in TortoiseHg (I use Mercurial) and found that they hadn't changed at all. Very strange. So I opened a layout in the Designer and just did a Save. Back to TortoiseHg to see if that changed anything - it didn't, from Mercurials perspective the file was still identical. However, looking at the file properties, I could see that the Modified timestamp was updated (naturally). Mercurial doesn't track such metadata.

Back to B4i to try with the re-saved, identical, layout - and now it worked without a flaw.

From my perspective this is a situation that's simple to fix myself - I just re-save everything and it works. I still felt it was worth reporting. I've also attached the log below, for when a layout caused a crash.

Might be worth mentioning that I haven't moved the project folder or any files in ages.

(The file in Files was an mp3 that I fixed by simply duplicating it in Explorer, deleting the old one and changed the name of the duplicate.)

B4X:
pageReport.RootPanel.LoadLayout("layoutreport")

caused:

B4X:
Error occurred on line: 36 (actreport)
Error opening stream: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}
Stack Trace: (
  CoreFoundation       <redacted> + 148
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  SandmanApp         -[B4IFile OpenInput::] + 436
  SandmanApp         -[B4ILayoutBuilder loadLayout:::] + 644
  SandmanApp         -[B4IPanelWrapper LoadLayout::] + 200
  SandmanApp         -[b4i_actreport _startactivitypage] + 1256
  SandmanApp         -[b4i_actworking _menureport_click] + 500
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
 SandmanApp         +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
 SandmanApp         -[B4IShell runMethod:] + 448
 SandmanApp         -[B4IShell raiseEventImpl:method:args::] + 1784
 SandmanApp         -[B4IShellBI raiseEvent:event:params:] + 1408
 SandmanApp         -[B4ICommon CallSub4::::] + 344
 SandmanApp         -[B4ICommon CallSub:::] + 156
 SandmanApp         -[b4i_actworking _mnuactionsheet_click:] + 2256
 CoreFoundation       <redacted> + 144
 CoreFoundation       <redacted> + 292
 SandmanApp         +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
 SandmanApp         -[B4IShell runMethod:] + 448
 SandmanApp         -[B4IShell raiseEventImpl:method:args::] + 1784
 SandmanApp         -[B4IShellBI raiseEvent:event:params:] + 1408
 SandmanApp         __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
 libdispatch.dylib    <redacted> + 24
 libdispatch.dylib    <redacted> + 16
 libdispatch.dylib    <redacted> + 968
 CoreFoundation       <redacted> + 12
 CoreFoundation       <redacted> + 2012
 CoreFoundation       CFRunLoopRunSpecific + 436
 GraphicsServices     GSEventRunModal + 100
 UIKit                UIApplicationMain + 208
 SandmanApp         main + 124
 libdyld.dylib        <redacted> + 4
)
 

Andris

Active Member
Licensed User
Longtime User
I have encountered a very strange problem. All of a sudden it seems that the app crashes when it loads a file. This has been verified both for layouts and a file in Files. None of these files have been modified recently and have previously worked just fine.

I was curious what had happened, in what way that were corrupted. So I took a look at them in TortoiseHg (I use Mercurial) and found that they hadn't changed at all. Very strange. So I opened a layout in the Designer and just did a Save. Back to TortoiseHg to see if that changed anything - it didn't, from Mercurials perspective the file was still identical. However, looking at the file properties, I could see that the Modified timestamp was updated (naturally). Mercurial doesn't track such metadata.

Back to B4i to try with the re-saved, identical, layout - and now it worked without a flaw.

From my perspective this is a situation that's simple to fix myself - I just re-save everything and it works. I still felt it was worth reporting. I've also attached the log below, for when a layout caused a crash.

Might be worth mentioning that I haven't moved the project folder or any files in ages.

(The file in Files was an mp3 that I fixed by simply duplicating it in Explorer, deleting the old one and changed the name of the duplicate.)

B4X:
pageReport.RootPanel.LoadLayout("layoutreport")

caused:

B4X:
Error occurred on line: 36 (actreport)
Error opening stream: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}
Stack Trace: (
  CoreFoundation       <redacted> + 148
  libobjc.A.dylib      objc_exception_throw + 56
  CoreFoundation       <redacted> + 0
  SandmanApp         -[B4IFile OpenInput::] + 436
  SandmanApp         -[B4ILayoutBuilder loadLayout:::] + 644
  SandmanApp         -[B4IPanelWrapper LoadLayout::] + 200
  SandmanApp         -[b4i_actreport _startactivitypage] + 1256
  SandmanApp         -[b4i_actworking _menureport_click] + 500
  CoreFoundation       <redacted> + 144
  CoreFoundation       <redacted> + 292
 SandmanApp         +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
 SandmanApp         -[B4IShell runMethod:] + 448
 SandmanApp         -[B4IShell raiseEventImpl:method:args::] + 1784
 SandmanApp         -[B4IShellBI raiseEvent:event:params:] + 1408
 SandmanApp         -[B4ICommon CallSub4::::] + 344
 SandmanApp         -[B4ICommon CallSub:::] + 156
 SandmanApp         -[b4i_actworking _mnuactionsheet_click:] + 2256
 CoreFoundation       <redacted> + 144
 CoreFoundation       <redacted> + 292
 SandmanApp         +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
 SandmanApp         -[B4IShell runMethod:] + 448
 SandmanApp         -[B4IShell raiseEventImpl:method:args::] + 1784
 SandmanApp         -[B4IShellBI raiseEvent:event:params:] + 1408
 SandmanApp         __33-[B4I raiseUIEvent:event:params:]_block_invoke + 60
 libdispatch.dylib    <redacted> + 24
 libdispatch.dylib    <redacted> + 16
 libdispatch.dylib    <redacted> + 968
 CoreFoundation       <redacted> + 12
 CoreFoundation       <redacted> + 2012
 CoreFoundation       CFRunLoopRunSpecific + 436
 GraphicsServices     GSEventRunModal + 100
 UIKit                UIApplicationMain + 208
 SandmanApp         main + 124
 libdyld.dylib        <redacted> + 4
)

I occasionally (maybe 2 times in the last month with B4i, and a few times in B4A as well) experience exactly this same problem, with no obvious cause in the integrity or location of the layout file, or with files that "can't be found." It always scares the hell out of me. The solution that always seems to work (keep fingers crossed) is to:
  1. Uninstall the target app on your device
  2. Do Tools > Clean Project
  3. Compile and run again
Resaving the problem layout file under a different name seems to work too, but usually this has to be done with most of the others as well which is a huge pain. And then there are still "unlocatable" files as well, most of the time.

Like I said, I think I've experienced this in B4A as well. Maybe it's a Designer issue in common to all products ... that only Erel can figure out ... ;)
 

Napier

New Member
Licensed User
I've been having the exact same issue. Every once in a while when I get up in the morning to begin coding, the newly compiled program which was working the night before and hasn't been changed says it is not able to locate layout files. Different to Sandman, to fix the problem, I save each layout to a new name, delete the old layouts and recompile and then the program works. Not a big deal, but it does take a few minutes, and like Andris, it scares the hell out of me although I'm getting used to it. I was just hoping to find a relatively quick fix here if others had the same issue.

The only thing I could think is that I have my project files on a thumbdrive and perhaps in some way the link to the files is lost overnight? Seems unlikely, but then, the error is odd as well.

Here is a part of my log:

Copying updated assets files (1)
Application_Start
Securities list built!
Building database!
Database built!
Application_Active
Error occurred on line: 306 (baMatrix)
Error opening stream: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory" UserInfo={_kCFStreamErrorCodeKey=2, _kCFStreamErrorDomainKey=1}
Stack Trace: (
CoreFoundation <redacted> + 148
libobjc.A.dylib objc_exception_throw + 56
CoreFoundation <redacted> + 0
Bidabacus -[B4IFile OpenInput::] + 436
Bidabacus -[B4ILayoutBuilder loadLayout:::] + 652
Bidabacus -[B4IPanelWrapper LoadLayout::] + 204
Bidabacus -[b4i_bamatrix _createcellpanel::::] + 1520
Bidabacus -[b4i_bamatrix _add_matrixcell::::] + 3612
Bidabacus -[b4i_bamatrix _populatematrixpanel] + 1836
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
Bidabacus +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
Bidabacus -[B4IShell runMethod:] + 448
Bidabacus -[B4IShell raiseEventImpl:method:args::] + 1784
Bidabacus -[B4IShellBI raiseEvent:event:params:] + 1408
Bidabacus -[B4ICommon CallSub4::::] + 344
Bidabacus -[B4ICommon CallSub2::::] + 360
Bidabacus -[b4i_httpjob _complete:] + 212
Bidabacus -[b4i_httputils2service _completejob::::] + 436
Bidabacus -[b4i_httputils2service _hc_responsesuccess::] + 164
CoreFoundation <redacted> + 144
CoreFoundation <redacted> + 292
Bidabacus +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1624
Bidabacus -[B4I raiseEvent:event:params:] + 564
Bidabacus __61-[B4IHttp URLSession:downloadTask:didFinishDownloadingToURL:]_block_invoke + 268
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 68
libdispatch.dylib <redacted> + 16
libdispatch.dylib <redacted> + 1016
CoreFoundation <redacted> + 12
CoreFoundation <redacted> + 2012
CoreFoundation CFRunLoopRunSpecific + 436
GraphicsServices GSEventRunModal + 100
UIKit UIApplicationMain + 208
Bidabacus main + 124
libdyld.dylib <redacted> + 4
)
 
Top