How can I tell where my XCode output originates from? - xcode

For example, in my console, I have output such as :
2012-11-29 21:25:40.696 Program[31053:707] -[Staff Shifts]: unrecognized selector sent to instance 0x107d6fdd0
2012-11-29 21:25:40.697 Program[31053:707] Exception detected while handling key input.
I was wondering if there's an easy way to find out where this is from?

The debug console can only tell you so much. According to the error, you are trying to access a selector (possibly) within the class Staff that isn't recognized by the instance of that class.
You could, however, use this bit of information to set a breakpoint within that class and step over methods until the exception reoccurs. Then you could set a breakpoint at that method and step into it until you find the problem.
You could also use gdb po at runtime to check for nil/unexpected objects.

The [Staff Shifts] might indicate that you have a class named [Staff Shifts] in your code that is causing the error. An unrecognized selector means that you have the following:
selector: #selector(FunctionName:)
But the function FunctionName: doesn't exist...

Related

Why is the layer-aware debugging feature not stopping when entering function group include in filtered object set?

i have specified the following object set in Debugger Layer config:
The function module is called:
And yet the program stops at my next breakpoint I set in this function module to document the layer debugging isn't stopping:
Stop in Line 213, not at the start. It's not the first statement eligible for setting a breakpoint if you're wondering that.
Anybody have any insight to why this is not working?
As you didn't say that you used the very important "NEXT OBJECT SET" button, I guess that's the reason why it didn't work.
Credits : reference and screenshot taken from https://blogs.sap.com/2010/07/27/layer-aware-debugging-in-nw-70-ehp2/

PyCharm debugger doesn't show objects' content: "Unable to get repr for <type 'list>"

Debugging with PyCharm (happens on multiple versions) I'm unable to correctly view some lists and dictionaries (other are presented correctly).
In the view window the object's name is presented with the message:
{list} Unable to get repr for <type 'list>
or
{dict} Unable to get repr for <type 'dict'>
An update:
In one of my attempts, I received the following message from the debugger (presented instead of the value of one of the list variable):
Unable to display children:Error resolving variables Traceback (most
recent call last): File "/Applications/PyCharm
CE.app/Contents/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line
1004, in do_it
_typeName, valDict = pydevd_vars.resolve_compound_variable(self.thread_id, self.frame_id,
self.scope, self.attributes) TypeError: 'NoneType' object is not
iterable
I'll appreciate any idea as for what may cause this behavior?
Thanks!
It turned out the problem is due to usage of rpyc.py: The process I was debugging was called through rpyc and while I was debugging it, the calling process received a timeout on the rpyc connection.
I think that this caused variables, passed through rpc to lose integrity so the debugger couldn't present them correctly.
The solution was to downgrade rpyc.py to version 3.3.0 (I was on 3.4.2).
My colleague, Nurit Izraelov, correctly suggested the rpyc.py version may be the blame.
Thanks all!
It happened to me sometimes and what caused the behaviour was that some MyClass triggered an exception on its str method.
In such a case, PyCharm debugger only showed
some_object = {MyClass} Unable to get repr for <class 'my_app.models.MyClass'>
So what I did to confirm the origin was to watch repr(some_object) in the Watches section of the debugger. And there it gave me an explicit error message:
{TypeError}%d format: a number is required, not NoneType
Which helped me trace back to the origin.
I appreciate this is not a generic answer, but just a complement to Fabio's.
Probably some custom class of yours has a bad __repr__ or __str__ in it and the debugger is unable to print it.
You can probably use a shell at that point to know which elements are actually inside such a dict or list (and see which object has the faulty __repr__ or __str__).
Extending the scope of the problem rather than adding an answer - all the other suggestions are what I do normally to get this working.
Could it be a race condition?
For me it appears to be something weird. In the Variables pane I can see correct representation for theObject, repr(theObject) and even [theObject] but if I set a variable in my code thus a = theObject or b = [theObject] then I get the "Unable to get repr for <class 'list'>" message.
theObject in this case is an instance of a subclassed D lang struct wrapped with autowrap.

Cannot read property 'findElementsOverride' of undefined

Protractor/jamine error message:
Failed: Cannot read property 'findElementsOverride' of undefined
any clue on whats causing this error message?
More details would have helped.At-least what caused the error:)
But I have faced this issue before and you will see this when using isElementPresent() in scenarios like below
expect(body.isElementPresent()).toBeTruthy();
The problem is that isElementPresent() is checks based on subLocator and doesnt accept null as argument
The docs state the proper way of using it
This checks whether the element identified by the subLocator is
present, rather than the current element finder
element(by.css('#abc')).isElementPresent(by.css('#def')).

Microsoft AJAX: Unable to get property 'x' of undefined or null reference

How do I troubleshoot the following error being thrown by a Microsoft AJAX JavaScript framework method? It is an automatically generated line of JavaScript from a custom User Control in a Web Forms App (Sitefinity 5 CMS)
Error Message:
Unable to get property 'FancyBlockDesigner' of undefined or null reference
Here is the JavaScript that is throwing the error:
Sys.Application.add_init(function() {
$create(SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner, null, null, {"Editor":"propertyEditor_ctl00_ctl00_ctl00_ctl00_ctl00_Editor","propertyEditor":"propertyEditor"}, $get("propertyEditor_ctl00_ctl00_ctl00"));
});
Rather than discuss the ascx and cs files that try to abstract this detail away from me, I want to know what this error means. If I understand the detail, the abstraction might make more sense.
"$create" function in ASP.NET Ajax creates an instance of JavaScript class. Microsoft had their own opinion on how to make JavaScript object orientated and as time had shown, their approach wasn't exactly perfect.
Anyhow, to try to explain what is happening, let me give a bit of an overview oh how it works. We start by a server side control which implements IScriptControl interface which mandates two members: GetScriptDescriptors and GetScriptReferences. The second one is pretty straightforward - it lets you register references to all JavaScript files that you control will require. The GetScriptDescriptors, on the other hand, let's you define all the instances of JavaScript classes you want to use as well as it lets you set their properties - initialize them, if you will.
What the autogenerated JavaScript code you've pasted says is basically that you have defined in GetScriptDescriptors that you will need an instance of type "SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner" where you want Editor property to be initialized. This code will go and look for a JavaScript constructor that looks like this:
function SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner(element) {
}
that most probably also has a prototype defined, something like:
SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner.prototype = {
}
Now, since the error you have posted states: "Unable to get property 'FancyBlockDesigner' of undefined or null reference", most probably one of the following is the problem:
You have not included the JavaScript file which contains the class (constructor + prototype) that I've talked about above
You have forgot to add the "FancyBlockDesigner" to the constructor (it seems that you do have other object, perhaps through MS Ajax namespaces - "SitefinityWebApp.Esd.TheLab"
You have not registerd the "SampleHtmlEditor" namespace. Make sure at the top of your JS file you have this: Type.registerNamespace("SitefinityWebApp.Esd.TheLab.SampleHtmlEditor");
So, short story long, the function with name "SitefinityWebApp.Esd.TheLab.SampleHtmlEditor.FancyBlockDesigner" cannot be found.
Hope this helps,
Ivan

QTP Run Error:Type does not match

Here is a sniplet of the QTP code :
Call CreateResultFile("E:\2012MX\Result\test_d\")
And the error is:
The test run cannot continue due to unrecoverable error. Type does not
match:'CreateResultFile'
What am I doing wrong?
This is the error you would get if CreateResultFile wasn't defined, are you sure such a function exists?
1) Somewhere CreateResultFile is declared as an variable, array or as an class/object. It cann't be called, but has to be used as an object of that type.
-or-
2) You did not use Option Explicit in your script (An Unforgivable Sin: each time you run a script without option explicit, somewhere on Earth a puppy dies). QTP sees undefined functions automagically as undeclared variables and complains with "Type mismatch" as explained in 1.
It could be you did not associate the library (vbs or qfl file) with the CreateResultFile function as a resource to the action you are working in.

Resources