New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TNS 3.1.3 eating exceptions #3105

Closed
NathanaelA opened this Issue Sep 5, 2017 · 7 comments

Comments

Projects
None yet
6 participants
@NathanaelA
Contributor

NathanaelA commented Sep 5, 2017

Please, provide the details below:

Doing a standard tns run ios will eat exceptions that occur.

Did you verify this is a real problem by searching

yes

Tell us about the problem

For some reason the newer versions of TNS seems to eat exceptions. It logged my CONSOLE logs fine then the app appeared to freeze. No output, it would allow updates to restart the app; but no exception/crash was logged to the screen. Finally after a lot of wasted time, running it in xcode; I got to see the actual exception report so I could fix the issue.

Which platform(s) does your issue occur on?

IOS

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.1.3

Please tell us how to recreate the issue in as much detail as possible.

I'm not 100% sure if it eliminates all exceptions, but NONE of this printed in TNS:

2017-09-05 13:46:10.998030 demo[2304:1299789] *** JavaScript call stack:
(
    0   UIApplicationMain@[native code]
    1   start@file:///app/tns_modules/tns-core-modules/application/application.js:211:26
    2   anonymous@file:///app/app.js:10:18
    3   evaluate@[native code]
    4   moduleEvaluation@:1:11
    5   @:7:50
    6   promiseReactionJob@:1:11
)
2017-09-05 13:46:10.998102 demo[2304:1299789] *** Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [GVRRendererViewController shouldAutorotate] is returning YES'
*** First throw call stack:
(0x18a3561c0 0x188d9055c 0x18a356108 0x190225e18 0x19022f0dc 0x19022f054 0x19022dafc 0x1901ad830 0x1901ad5b8 0x1901ad5b8 0x1901ad5b8 0x1901ad5b8 0x1901d13e8 0x1901ad5b8 0x1901ad5b8 0x1901aca64 0x1901ac8bc 0x1901b87a4 0x1901b8090 0x1902745ac 0x19026a840 0x19026990c 0x1902694c0 0x190269424 0x1901ae220 0x18d66e188 0x18d662e64 0x18d662d24 0x18d5df7ec 0x18d606c58 0x18d607678 0x18a3037dc 0x18a30140c 0x18a230068 0x19021c2b0 0x190217034 0x1018e8044 0x1018e711c 0x1018e6c34 0x10101d4fc 0x101651b94 0x10165a218 0x10165a228 0x101653b08 0x1015f35a0 0x1015d053c 0x101730174 0x10102dfe4 0x1017bc3d0 0x10165abf4 0x10165a228 0x10165a228 0x10165a228 0x101653b08 0x1015f35a0 0x1015d053c 0x101730240 0x1017b8060 0x101025afc 0x10106605c 0x1000a6f9c 0x1892145b8)
libc++abi.dylib: terminating with uncaught exception of type NSException

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

Should be something simple like do something that causes a NSException and see if TNS reports it.

@Mitko-Kerezov

This comment has been minimized.

Show comment
Hide comment
@Mitko-Kerezov

Mitko-Kerezov Oct 5, 2017

Collaborator

Hi, @NathanaelA

Thank you for the detailed description of the issue, however I was unable to reproduce it.
I tried adding new NSArray().objectAtIndex(5) to the application, which causes an NSException but it is correctly displayed every time during tns run ios. If you could provide a sample application, which illustrates the issue, that would be extremely helpful.

As a workaround in such cases, we recommend running tns device log in a separate console where no logs will be filtered out and where you should be able to see everything.

Collaborator

Mitko-Kerezov commented Oct 5, 2017

Hi, @NathanaelA

Thank you for the detailed description of the issue, however I was unable to reproduce it.
I tried adding new NSArray().objectAtIndex(5) to the application, which causes an NSException but it is correctly displayed every time during tns run ios. If you could provide a sample application, which illustrates the issue, that would be extremely helpful.

As a workaround in such cases, we recommend running tns device log in a separate console where no logs will be filtered out and where you should be able to see everything.

@NathanaelA

This comment has been minimized.

Show comment
Hide comment
@NathanaelA

NathanaelA Oct 6, 2017

Contributor

Here you go; I just created a use case where this crashes the real device with no output beyond the first console.log('Hi!')

function crashMe() {
  console.log("Hi!");
  var someString=null;
   let truncated = NSString.stringWithUTF8String(someString);
   let trunc2 = NSString.stringWithUTF8String(truncated);
   console.log("hello");    
}

The above code is totally invalid and if you use idevicesyslog you will see:

Oct  6 12:51:00 Nathanaels-iPhone test3(NativeScript)[355] <Notice>: CONSOLE LOG file:///app/main-view-model.js:12:14: Hi!
Oct  6 12:51:00 Nathanaels-iPhone test3[355] <Notice>: *** JavaScript call stack:
(
	0   stringWithUTF8String@[native code]
	1   crashMe@file:///app/main-view-model.js:14:49
	2   onTap@file:///app/main-view-model.js:33:16
	3   notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:100:37
	4   _emit@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:120:24
	5   tap@file:///app/tns_modules/tns-core-modules/ui/button/button.js:207:24
	6   UIApplicationMain@[native code]
	7   start@file:///app/tns_modules/tns-core-modules/application/application.js:211:26
	8   anonymous@file:///app/app.js:10:18
	9   evaluate@[native code]
	10  moduleEvaluation@:1:11
	11  @:7:50
	12  promiseReactionJob@:1:11
)
Oct  6 12:51:00 Nathanaels-iPhone test3(CoreFoundation)[355] <Notice>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString'
*** First throw call stack: ...

TNS only shows:

CONSOLE LOG file:///app/main-view-model.js:12:14: Hi!
Contributor

NathanaelA commented Oct 6, 2017

Here you go; I just created a use case where this crashes the real device with no output beyond the first console.log('Hi!')

function crashMe() {
  console.log("Hi!");
  var someString=null;
   let truncated = NSString.stringWithUTF8String(someString);
   let trunc2 = NSString.stringWithUTF8String(truncated);
   console.log("hello");    
}

The above code is totally invalid and if you use idevicesyslog you will see:

Oct  6 12:51:00 Nathanaels-iPhone test3(NativeScript)[355] <Notice>: CONSOLE LOG file:///app/main-view-model.js:12:14: Hi!
Oct  6 12:51:00 Nathanaels-iPhone test3[355] <Notice>: *** JavaScript call stack:
(
	0   stringWithUTF8String@[native code]
	1   crashMe@file:///app/main-view-model.js:14:49
	2   onTap@file:///app/main-view-model.js:33:16
	3   notify@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:100:37
	4   _emit@file:///app/tns_modules/tns-core-modules/data/observable/observable.js:120:24
	5   tap@file:///app/tns_modules/tns-core-modules/ui/button/button.js:207:24
	6   UIApplicationMain@[native code]
	7   start@file:///app/tns_modules/tns-core-modules/application/application.js:211:26
	8   anonymous@file:///app/app.js:10:18
	9   evaluate@[native code]
	10  moduleEvaluation@:1:11
	11  @:7:50
	12  promiseReactionJob@:1:11
)
Oct  6 12:51:00 Nathanaels-iPhone test3(CoreFoundation)[355] <Notice>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSString stringWithUTF8String:]: NULL cString'
*** First throw call stack: ...

TNS only shows:

CONSOLE LOG file:///app/main-view-model.js:12:14: Hi!
@Mitko-Kerezov

This comment has been minimized.

Show comment
Hide comment
@Mitko-Kerezov

Mitko-Kerezov Oct 9, 2017

Collaborator

@NathanaelA
Thank you for the provided repro.
I can confirm that the exception log is missing in the output of tns run ios command (and related commands, which should print the console logs, like tns debug ios). The problem is in the filtering, which we apply in order to show only logs from current application.
We'll try to address the issue, but meanwhile you can use tns device log in a separate console. This will show the full device log, where the exception will be visible. Note you do not need any external tools to run this command - it is just a regular CLI command.

Collaborator

Mitko-Kerezov commented Oct 9, 2017

@NathanaelA
Thank you for the provided repro.
I can confirm that the exception log is missing in the output of tns run ios command (and related commands, which should print the console logs, like tns debug ios). The problem is in the filtering, which we apply in order to show only logs from current application.
We'll try to address the issue, but meanwhile you can use tns device log in a separate console. This will show the full device log, where the exception will be visible. Note you do not need any external tools to run this command - it is just a regular CLI command.

@Mitko-Kerezov Mitko-Kerezov added the bug label Oct 9, 2017

@NathanaelA

This comment has been minimized.

Show comment
Hide comment
@NathanaelA

NathanaelA Oct 9, 2017

Contributor

@Mitko-Kerezov - Well that is interesting to know that tns device log would have allowed me to see the missing exceptions. ;-) But since I also frequently run into #3106 also, using another tool idevicesyslog eliminates having tns mess up and strip out many of my "console.log" statements. So, I personally would recommend people use idevicesyslog over tns for logging from a real device until the cause of 3106 is discovered as it actually solves both 3105 and 3106 at the same time. 😀

Contributor

NathanaelA commented Oct 9, 2017

@Mitko-Kerezov - Well that is interesting to know that tns device log would have allowed me to see the missing exceptions. ;-) But since I also frequently run into #3106 also, using another tool idevicesyslog eliminates having tns mess up and strip out many of my "console.log" statements. So, I personally would recommend people use idevicesyslog over tns for logging from a real device until the cause of 3106 is discovered as it actually solves both 3105 and 3106 at the same time. 😀

@rosen-vladimirov

This comment has been minimized.

Show comment
Hide comment
@rosen-vladimirov

rosen-vladimirov Oct 9, 2017

Contributor

Hey @NathanaelA ,
It looks like the problem in #3106 is again the filtering and most probably the many logs your application has. In fact, I believe the problem is that we receive only part of the message (CONSOLE ERROR file:///app/tns_modules), it matches our regex, we print it and the second part of the error (nativescript-angular/zone-js/dist/zone-nativescript.js:571:22: Error: Uncaught (in promise): Error: Animation cancelled.) is received after that, but it does not match our regex filtering.

Anyway, I wanted to note that the problem is the filtering, but tns device log does not apply any filter - it just prints to the stdout everything from device logs, so the whole error from #3106 will be shown. Of course, you can use idevicesyslog or tns device log - it is up to you to decide which one is most suitable for you.

Thank you again for the detailed report of this issue and providing the workaround, so anyone that hits the same problem will be able to find it and use it easily.

Contributor

rosen-vladimirov commented Oct 9, 2017

Hey @NathanaelA ,
It looks like the problem in #3106 is again the filtering and most probably the many logs your application has. In fact, I believe the problem is that we receive only part of the message (CONSOLE ERROR file:///app/tns_modules), it matches our regex, we print it and the second part of the error (nativescript-angular/zone-js/dist/zone-nativescript.js:571:22: Error: Uncaught (in promise): Error: Animation cancelled.) is received after that, but it does not match our regex filtering.

Anyway, I wanted to note that the problem is the filtering, but tns device log does not apply any filter - it just prints to the stdout everything from device logs, so the whole error from #3106 will be shown. Of course, you can use idevicesyslog or tns device log - it is up to you to decide which one is most suitable for you.

Thank you again for the detailed report of this issue and providing the workaround, so anyone that hits the same problem will be able to find it and use it easily.

@NathanaelA

This comment has been minimized.

Show comment
Hide comment
@NathanaelA

NathanaelA Oct 9, 2017

Contributor

@rosen-vladimirov - Awesome, it is good to know that once tns fixes the ios 11 logging issues; that tns device log would work as a generic logging system so that people don't have to install anything else. 👍

Contributor

NathanaelA commented Oct 9, 2017

@rosen-vladimirov - Awesome, it is good to know that once tns fixes the ios 11 logging issues; that tns device log would work as a generic logging system so that people don't have to install anything else. 👍

@Fatme

This comment has been minimized.

Show comment
Hide comment
@Fatme

Fatme Apr 6, 2018

Contributor

Hi @NathanaelA,

We're improving our logging for iOS platform. Can you please give it a try?

npm install -g nativescript@rc
Contributor

Fatme commented Apr 6, 2018

Hi @NathanaelA,

We're improving our logging for iOS platform. Can you please give it a try?

npm install -g nativescript@rc

@Fatme Fatme added this to the 4.0.0 milestone Apr 11, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment