ERROR: Object reference not set to an instance of an object

This forum is for all Flare issues related to getting started and installing the application.
ccardimon
Propellus Maximus
Posts: 1571
Joined: Fri Jan 11, 2008 1:30 pm
Location: Horsham, Pennsylvania

ERROR: Object reference not set to an instance of an object

Post by ccardimon »

Can someone fill me in on what this error is trying to tell me?

It is saying something bad happened, but it is saying so in programming terms, not in plain English.
Craig

Lost in Disturbia
ccardimon
Propellus Maximus
Posts: 1571
Joined: Fri Jan 11, 2008 1:30 pm
Location: Horsham, Pennsylvania

Re: ERROR: Object reference not set to an instance of an object

Post by ccardimon »

Wait a minute. Nevermind. I posted this error before. There is no good answer. Sigh.
Craig

Lost in Disturbia
sarrants
Propeller Head
Posts: 86
Joined: Tue Sep 18, 2007 6:04 am
Location: South Burlington, VT

Re: ERROR: Object reference not set to an instance of an object

Post by sarrants »

I was struggling with this error for a while, but none of the suggestions throughout the site worked. Turned out I had a couple of

Code: Select all

span 
tags that weren't closed. When I found and fixed them, compiled with no errors.
The things that we plan and measure are the things that get done.
ccardimon
Propellus Maximus
Posts: 1571
Joined: Fri Jan 11, 2008 1:30 pm
Location: Horsham, Pennsylvania

Re: ERROR: Object reference not set to an instance of an object

Post by ccardimon »

Most of Flare's error messages are dead on target, but I have found this one can be wildly off the mark.

The error can reside within code you imported from elsewhere, such a Word document or RoboHelp project, and it's read as an error by Flare. The other environments don't read it, or don't care. Flare does care.

This error has driven me crazy because solving it usually means diving into the code behind the scenes. The code you normally simply don't see.
Craig

Lost in Disturbia
Graham Campbell
Propeller Head
Posts: 54
Joined: Tue Oct 30, 2007 4:40 am
Location: Glasgow, Scotland, UK

Re: ERROR: Object reference not set to an instance of an object

Post by Graham Campbell »

I'm seeing this error message displayed when trying to open my (previously working) stylesheets in Flare 4. Works fine in the old Flare3.1.

I'd rather not have to go back to editing stylesheets in a separate editor.
Richard Ferrell
Propellus Maximus
Posts: 840
Joined: Mon May 01, 2006 10:11 am
Location: Inside California

Re: ERROR: Object reference not set to an instance of an object

Post by Richard Ferrell »

I would open a support ticket so that we can look at your project.

https://www.madcapsoftware.com/support/contact.aspx
Richard Ferrell

Certified Madcap Trainer
Image
wijnand
Propeller Head
Posts: 55
Joined: Fri Nov 03, 2006 1:22 am
Location: Netherlands
Contact:

Re: ERROR: Object reference not set to an instance of an object

Post by wijnand »

The Error you are receiving is a .NET error. Generally it means that something in flare is referincing to a object that does not exist. I occasionally get this error when I edit my TOC outside of Flare while flare is open and make a few mistakes. The best thing to do is run analyser and see if you have XML files that are damaged. If an XML file is damaged it will give you a notice saying that the file is not converted (while it is). If nothing is wrong with your projects. Try installing .NET 3.5. What where you doing while the error occured?
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: ERROR: Object reference not set to an instance of an object

Post by RamonS »

What would be really helpful is to have Flare report what the object is and what it tried to reference and what it got returned (which typically is nothing). Barfing up errors that the .NET runtime throws and leaving it at that is just laziness from the developers part, lack of requirements from the BA, QA that just lets bugs like that go through, and it shows an overall lack of customer focus in this aspect. There is no excuse for crappy error reporting.
wijnand
Propeller Head
Posts: 55
Joined: Fri Nov 03, 2006 1:22 am
Location: Netherlands
Contact:

Re: ERROR: Object reference not set to an instance of an object

Post by wijnand »

Ramons,

As someone who programs in C# and Java I can tell you its INCREDIBLY hard to catch every single error Flare can barf out. Basically to catch errors a programmer has to do one of the following (there are a lot more options ofcourse!):

Code: Select all

Try
{
  Read Object X
  Do Y
  Save to file
}
catch(NullException ex)
{
   MSGbox.show(ex.tostring()) <- results in the .NET barf you are getting 
}

This code basically means I get a popup stating I did something bad but not what. as a programmer its REALLY hard to guess when this eror can result Maybe the object wasn't read, or maybe the object was read but it was empty. And the list goes on. This error can also jump up if the file saving went wrong. And if I start writing manually what the error can compass I will just make it harder to read specially when the error was caused by something else.

The only way to figure out what caused it is to read the error dump you tend to get in the details button then you know what it was trying to do.
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: ERROR: Object reference not set to an instance of an object

Post by RamonS »

So maybe the developers need to use a better platform to develop on or write their own error reporting rather than use the build in one. I don't say it is easy, but just showing "Object reference not set to an instance of an object" and nothing else is utterly useless - for the user and apparently for the developer as well as you state. Why do developers use platforms like that? To be honest, I now live in a Delphi world and some error messages aren't any better.
Does that error dump tell the developers anything? I looked at it at times, but the insane size makes it difficult to pass on. Maybe what it comes down to is that we need better development tools, better runtimes, and more QA.
I code in PHP and rarely run into such obscure and useless error messages. I do admit that in critical areas I do tend to be paranoid and check if the item I want to collect indeed exists. Code can be written for that and it works out nicely, the problem is that it isn't great for performance since code has to be executed that in 99% of the cases is not needed.
wijnand
Propeller Head
Posts: 55
Joined: Fri Nov 03, 2006 1:22 am
Location: Netherlands
Contact:

Re: ERROR: Object reference not set to an instance of an object

Post by wijnand »

Sadly the way programming goes nowadays is that a lot of things are taken out of your hands. Flare is built ontop of .NET and requires it to be installed before it can function. Java has the exact same problem, being able to grab errors and identify them is very hard. I know that our C++ program spews 10 errors whenever you get one error all with different meanings.

As for the error you are seeing, its a dump of what Flare was doing with .NET its not flare itself thats crashing but its .NET thats causing it because it received according to him incomplete information. I tend to copy and paste them. What you will be seeing are the functions that flare was calling and what was being filled with information. The programmer who made Flare should be able to read what is going on but its very hard. Thats why .NET dumps the error messages that for a normal customer are a bit harder to grasp. Sadly what I tend to tell people who get these errors is to try and reproduce it then see when it actually happens. Usually its one of the topics/files causing the hicup.

I also wish there was beter error reporting, but doing that alone can take a lot of development work sadly. And its a thing that you need to look as being a small problem to the endless list fo feature requests ;)
Cecily
Sr. Propeller Head
Posts: 217
Joined: Wed Sep 10, 2008 6:01 am
Location: England

Re: ERROR: Object reference not set to an instance of an object

Post by Cecily »

Stepping back from the techie detail, I sometimes get it when dragging a topic, snippet or image from the Content Explorer into a topic page. It seems to be if I do it too quickly, before it's quite registered what's been selected. When it happens, I just click somewhere else, and try again to drag and drop, and it's usually fine.
"Books are a narcotic." (Franz Kafka)
I wonder what he'd say about help files?
ccardimon
Propellus Maximus
Posts: 1571
Joined: Fri Jan 11, 2008 1:30 pm
Location: Horsham, Pennsylvania

Re: ERROR: Object reference not set to an instance of an object

Post by ccardimon »

Thanks for the tip!
Craig

Lost in Disturbia
peterbrown05
Propeller Head
Posts: 52
Joined: Fri Jun 18, 2010 9:08 am

Re: ERROR: Object reference not set to an instance of an object

Post by peterbrown05 »

for what its worth; i just had this problem after doing a word import. had a page which had entire topic set with a p.NumberedItem style (which I didnt want). I deleted the p.Numberedstyle from the topic and this resulted in the error.

turns out that it also deleted the

Code: Select all

<body> .... </body>
!!!

once the body tag was added; all came good again.

Fortunately I knew which file I had been editing; it would be useful if the build spat out a log of the last file processed/current file being processed when the error happens....
jacortes
Propeller Head
Posts: 45
Joined: Thu Oct 16, 2008 1:11 pm

Re: ERROR: Object reference not set to an instance of an object

Post by jacortes »

I had a strange occurrence with this error I thought was worth sharing.

Problem: The "Object error not an instance of object" error was occurring at the tail end of my PDF build each time I compiled.

To pinpoint the topic which could be missing a tag, as has been described, I added my chapters one at a time to my TOC and compiled. I did not see the error again until I added the tenth chapter and compiled. I went through each topic in the chapter, but they all opened with no problems and the XML was fine. I compiled a pdf for each topic individually and never saw the error.

Confused, I repeated my original process, adding the chapters back to my TOC one at a time in reverse order, compiling each time. Again, I did not see the error until I added the tenth chapter and compiled. This time, the tenth chapter was really chapter 1 and I knew my topics therein were fine because I had already compiled with them during my first test.


Fix Details:
  • I have a paragraph style with mc-auto-number-format: GA:Chapter {n+}
  • This paragraph style resides on the first page of a Page Layout. I have the word "Chapter" followed by the incrementing number on this page.
  • The text box that contains the word "Chapter" and the incrementing number was just not wide enough to handle the extra digit when I got to double-digit chapters.

Fix: I widened the text box in the Page Layout and recompiled. No error.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

Re: ERROR: Object reference not set to an instance of an object

Post by i-tietz »

aha ... intelligent environment needed, maybe even a learning one?`Why don't you write one, then?
This is not as easy as you think it is.
Examples:
1. I have a statement using a variable tha I declared at the top of the procedure - at least I think that's what I did. But I mistyped it - used a small "l" instead of a big "I" - looks the same but isn't. Still: The compiler tells me the problem is the statement ... how is the compiler supposed to find out it was a mistyping error?
2. I have a statement using a variable I declared at the top of the procedure - this time it was spelled correctly - so where's the mistake? I handled the variable in between with a function that has format "string" as output. But the error statement needs a number ... how is the compiler supposed to find out the mistake was made by using that function?

Sometimes the cause of errors is even outside the procedure ... then there's hardly a way to name the real cause of the problem.
But if whining is a relief - feel free!
Inge____________________________
"I need input! - Have you got input?"
peterbrown05
Propeller Head
Posts: 52
Joined: Fri Jun 18, 2010 9:08 am

Re: ERROR: Object reference not set to an instance of an object

Post by peterbrown05 »

But if whining is a relief - feel free!
come on.... people are sharing their problems here in the attempt to help others out.

This particular error message would be more useful if it named the file it was processing when the error occured. This would at least save a lot of time in most of the cases here. Sure, the latest report of a text box not being large enough is odd; but again having a starting point to work from would be useful.

p
jacortes
Propeller Head
Posts: 45
Joined: Thu Oct 16, 2008 1:11 pm

Re: ERROR: Object reference not set to an instance of an object

Post by jacortes »

i-tietz wrote:aha ... intelligent environment needed, maybe even a learning one?`Why don't you write one, then?
i-tietz wrote:But if whining is a relief - feel free!
I actually wasn't whining at all. I fixed my own error. The point is, Flare gives an obscure error message that can mean many things. Mine was just an example.


But if being contentious is a shortcoming - carry on. I actually have work to do.
i-tietz
Propellus Maximus
Posts: 1219
Joined: Wed Oct 24, 2007 4:13 am
Location: Fürth, Germany

ERROR: Object reference not set to an instance of an object

Post by i-tietz »

@jacortes: Sorry - didn't mean you! You did not complain about the lack of information in the message ... that was before your post.
Inge____________________________
"I need input! - Have you got input?"
kevinmcl
Sr. Propeller Head
Posts: 250
Joined: Mon Sep 11, 2006 10:58 am

Re: ERROR: Object reference not set to an instance of an object

Post by kevinmcl »

I sometimes get the "Object reference not set..." error when selecting.

I normally avoid importing from any other program. I run everything through Notepad first to have incoming material be as "vanilla" as humanly (and machinely) possible.

One thing that I do in many places is write a numbered list that includes command-line input and output. Rather than starting and stopping list numbering over and over and over, to place example code paragraphs in between numbered steps, I make big individual instruction steps (numbered list elements) and then format them. So, a couple of steps in a list might be a line or two long, then the next few will be ten lines long, each. I write the instruction step, then paste in the command-line text that shows the interaction of doing that step, as part of the unbroken numbered-list paragraph. Then, I use [Shift][Enter] to make the line breaks within that paragraph, and finally I select the command-line sample text and apply character style ".code" to it. This keeps the whole mess as one paragraph, and I don't have to mess with list number start-stop-start-again.

I find out that something is amiss when I try to select a multi-line portion of the "li" paragraph (preparatory to formatting it with ".code" character style), and blooey! the "Object reference not set...." appears. (That's only one example of where "Object reference not..." can appear.)

At the same time, most, or all of the page content disappears, and I'm looking at a Flare window with the WYSIWYG editing frame just white space. If I toggle the "Show Tags" button, it switches to a tagged text view with nothing in it. At this point, I'm afraid to save it in broken fashion (since I can't see anything to make a judgement call), so I quit Flare. When I restart, it might come back visible (without my recent work that I couldn't/wouldn't save), or it might come back all blank again. If it's still all blank, then I close Flare and edit the page in Notepad or NotePad++, find a broken tag-pair or an incorrect span, fix the tags, and try again. Usually that'll do the job, but it can take an hour or two out of my day.

My complaint, of course, is that Flare let this happen in the first place. It's NOT like I brought in any broken tags or spans. I brought in plain text, or I wrote some plain text, or I dragged some existing text from the same topic. Flare should never, ever allow me to make an incorrect selection (partially spanning something) without:

a) alerting me when I'm trying to do it

and/or

b) simply stripping out any tags/spans that are not complete sets, from within any selected text, so that whatever gets pasted is always either self-contained in terms of tag-sets/spans, or is entirely denuded plain-text, stripped of tags and spans (and therefore... safe).

In general, I want to be able to select any text, no matter what it spans or overlaps. I'd rather have to paste vanilla text and re-format it at my new location than have something break because Flare let my selection go out-of-bounds and didn't tell me it was miffed until it decided to barf on my lap.

Mostly Flare seems kinda smart, until it slaps me in the face with a bunch of re-work. If I'm breaking something, I want to know as I make the attempt, not when it's too late. If I'm breaking something because I've overlapped a feature or structure, I want the option to have the selection simply stripped nekkid, so it can safely be put anywhere, or taken to the next/previous allowable selection boundary. In fact, if I'm making a selection that would break something, were I to simply delete it, then ask me whether I want to expand my selection (to the next acceptable boundary), shrink my selection (same...), or continue my selection as-is, but with the option to "Delete" grayed out. Similarly, the Paste operation should look at the clipboard contents for unbalanced tags and spans, and offer to paste with tags/formatting stripped.

- kevin (asking too much again)

PS: No, as strange as it might sound, I don't want to spend a day or so stripping five hundred pages and a couple of hundred graphic files out of one of my projects to make it small enough to upload, in hopes that whatever causes the problem is still in the stub-project that remains.
De gustibus non disputandum est
RamonS
Senior Propellus Maximus
Posts: 4293
Joined: Thu Feb 02, 2006 9:29 am
Location: The Electric City

Re: ERROR: Object reference not set to an instance of an object

Post by RamonS »

kevinmcl wrote:PS: No, as strange as it might sound, I don't want to spend a day or so stripping five hundred pages and a couple of hundred graphic files out of one of my projects to make it small enough to upload, in hopes that whatever causes the problem is still in the stub-project that remains.
Are you referring to the (pathetic) 2MB file size upload maximum in the bug submission form? In that case you can email the project to support or if that is not possible ask them for FTP access.
JudyH
Propeller Head
Posts: 63
Joined: Fri Oct 12, 2007 12:25 pm

Re: ERROR: Object reference not set to an instance of an object

Post by JudyH »

Maybe it will help if we list instances that we found that will result in this error. It might make it easier for others to pinpoint problems.

Here is one ...

I had text about a rarely used function that will be important to a small percentage of clients. So I put it in drop-down text -- but I also included an index reference, so those who need it can find it easily.

As noted, there is little indication of the cause of the "Object reference not set" error, so I used the "process of elimination" strategy already discussed. First, I created a copy of the TOC and mapped the target temporarily to that. Then I deleted chapters, and sections within a copy of the chapter, until I isolated the problem area.

It turned out that the index (keyword) entry had been placed between the MadCap:dropDownHead open tag and the MadCap:DropDownBody open tag. This was apparent only in the text editor. I moved the keyword code outside of the drop-down code, which resolved the compile error.
Judy Hennessey
Image
kevinmcl
Sr. Propeller Head
Posts: 250
Joined: Mon Sep 11, 2006 10:58 am

Re: ERROR: Object reference not set to an instance of an object

Post by kevinmcl »

JudyH said:
"It turned out that the index (keyword) entry had been placed between the MadCap:dropDownHead open tag and the MadCap:DropDownBody open tag. This was apparent only in the text editor. I moved the keyword code outside of the drop-down code, which resolved the compile error."

But, but, but... the question is: HOW did you manage to get that index entry in what Flare considers to be the wrong place? If Flare and Flare's programmers know that something (or anything) is not permitted between one tag and another, it should :

a) prevent insertion in that location, via the Flare interface (and tell you why as you attempt it)

or

b) allow it, but change the color of the offending-and-offended locale to (say) flashing international rescue orange, so you know that something is amiss at that location.

It's been a byword of UI programming for all of this century, and part of the previous one, that a properly designed UI never allows the user to perform an action that breaks the software. They can't necessarily control what you do outside the user interface (say, with an external text editor), but they have as much control as they care to exert over what you do, and how you do it, within the UI that they programmed. At the very least, it's an incredible disservice to allow the user to use the controlled environment of the UI to shoot himself/herself in the foot, and not even tell her/him until later. If this is yet another instance of something that .NET does badly, and MadCap is just going along with it, then that's not right. If you accept to build on a framework that's riddled with nasty flaws that don't get fixed, generation after generation, then at least pick a cross-platform framework.

Even better, pick an open-source cross-platform framework.

-k
De gustibus non disputandum est
FrankyT
Propeller Head
Posts: 56
Joined: Wed Apr 04, 2012 3:45 am
Location: United Kingdom

Re: ERROR: Object reference not set to an instance of an object

Post by FrankyT »

wijnand wrote:The programmer who made Flare should be able to read what is going on but its very hard. Thats why .NET dumps the error messages that for a normal customer are a bit harder to grasp.
"A bit harder to grasp" - that's an understatement :) Most Flare users aren't programmers and probably don't even know what a reference, an instance or an object are.

If you're not a programmer, you shouldn't need to know these things...

I'm a hobbyist programmer, so I know what a reference, and instance and an object are, but the lack of detail in this error message renders it pretty much useless.

I've just come across the error with compiling for PDF and am still trying to work out what's wrong after several hours of research... :(

OK, got that out of my system... There are a few leaders in this thread at least.
nickatwork
Sr. Propeller Head
Posts: 457
Joined: Thu Sep 16, 2010 6:31 am
Location: London

Re: ERROR: Object reference not set to an instance of an object

Post by nickatwork »

.
Post Reply