Skip to content

iOS recordHandledExceptionWithStackTrace shows blank 0x0 for all lines #344

Open
@trenton05

Description

Description

I am using the newrelic-react-native-agent library to report javascript errors, but it looks like errors are all trying to get translated into a native address and then dSYM looked up which does not exist for the JS and shows up blank.

Steps to Reproduce

We are doing our own source map work and then submitting to this agent with the code the library uses like this for recordHandledException:

    NSMutableDictionary* attributes = [NSMutableDictionary new];
    attributes[@"name"] = exceptionDictionary[@"name"];
    attributes[@"reason"] = exceptionDictionary[@"message"];
    attributes[@"fatal"] = exceptionDictionary[@"isFatal"];
    attributes[@"cause"] = exceptionDictionary[@"message"];
    attributes[@"JSAppVersion"] = exceptionDictionary[@"JSAppVersion"];
    attributes[@"minify"] = exceptionDictionary[@"minify"];
    attributes[@"dev"] = exceptionDictionary[@"dev"];
    attributes[@"runModule"] = exceptionDictionary[@"runModule"];
    attributes[@"modulesOnly"] = exceptionDictionary[@"modulesOnly"];
    
    NSMutableDictionary* stackFramesDict = exceptionDictionary[@"stackFrames"];
    if(stackFramesDict == nil) {
        NSLog(@"[NRMA] No stack frames given to recordHandledException");
        return;
    }
    
    
    NSMutableArray* stackFramesArr = [NSMutableArray new];
    for (int i = 0; i < [stackFramesDict count]; ++i) {
        NSMutableDictionary* currStackFrame = stackFramesDict[@(i).stringValue];
        NSMutableDictionary* stackTraceElement = [NSMutableDictionary new];
        stackTraceElement[@"file"] = (currStackFrame[@"file"] && currStackFrame[@"file"] != [NSNull null]) ? currStackFrame[@"file"] : @" ";
        stackTraceElement[@"line"] = (currStackFrame[@"lineNumber"] && currStackFrame[@"lineNumber"] != [NSNull null]) ? currStackFrame[@"lineNumber"] : 0;
        stackTraceElement[@"method"] = (currStackFrame[@"methodName"] && currStackFrame[@"methodName"] != [NSNull null]) ? currStackFrame[@"methodName"] : @" ";
        stackTraceElement[@"class"] = @" ";
        [stackFramesArr addObject:stackTraceElement];
    }
    
    attributes[@"stackTraceElements"] = stackFramesArr;
    [NewRelic recordHandledExceptionWithStackTrace:attributes];

Go into newrelic and look at the handled exceptions. It shows a stack with exactly as many lines as were reported, but every line is blank at address 0x0.

Expected Behavior

Just show exactly what we put in for the stack traces, not try to do a dSYM translation or whatever it does to end up with 0x0.

Relevant Logs / Console output

Your Environment

Additional context

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions