Click here to Skip to main content
15,916,702 members
Home / Discussions / C#
   

C#

 
GeneralRe: Dispose method calls itself for no reason Pin
Luc Pattyn5-Jan-09 13:38
sitebuilderLuc Pattyn5-Jan-09 13:38 
GeneralRe: Dispose method calls itself for no reason Pin
mirko865-Jan-09 13:50
mirko865-Jan-09 13:50 
GeneralRe: Dispose method calls itself for no reason Pin
Luc Pattyn5-Jan-09 14:37
sitebuilderLuc Pattyn5-Jan-09 14:37 
GeneralRe: Dispose method calls itself for no reason Pin
MidwestLimey5-Jan-09 14:30
professionalMidwestLimey5-Jan-09 14:30 
GeneralRe: Dispose method calls itself for no reason Pin
Mark Churchill5-Jan-09 16:40
Mark Churchill5-Jan-09 16:40 
AnswerRe: Dispose method calls itself for no reason Pin
Jon Rista6-Jan-09 10:26
Jon Rista6-Jan-09 10:26 
GeneralRe: Dispose method calls itself for no reason Pin
mirko866-Jan-09 11:08
mirko866-Jan-09 11:08 
GeneralRe: Dispose method calls itself for no reason Pin
Jon Rista6-Jan-09 11:45
Jon Rista6-Jan-09 11:45 
I am guessing it only happens some of the time because only a subset of the data that your Save method encounters is causing the problem. If you really want to nip this thing in the bud, you need to try and catch the exceptions sooner. Part of the reason your having trouble is your catching the exception too late...its bubbling up the call stack, and in the process, its causing objects like your Forms to fail (which in turn causes them to be disposed and garbage collected). You are catching the exception, but only at the very last possible moment, after the application has essentially crashed.

I can't give you specifics with the information I have at hand, but you need to wrap a try/catch around code farther up the call stack. If you can trap the exception early, you can find out what is causing it because you will be able to use the VS debugger to examine object instances and values (which are all garbage collected by the time your exception hits the catch you posted above). (If you can post some of your code related to this save operation, particularly where you think the NullReferenceException may be getting thrown, I can help more.)
GeneralRe: Dispose method calls itself for no reason Pin
mirko866-Jan-09 11:57
mirko866-Jan-09 11:57 
GeneralRe: Dispose method calls itself for no reason Pin
mirko866-Jan-09 12:37
mirko866-Jan-09 12:37 
QuestionHow to use C# class library dll controls in C++ Win32 project Pin
atisman5-Jan-09 10:10
atisman5-Jan-09 10:10 
AnswerRe: How to use C# class library dll controls in C++ Win32 project Pin
EliottA5-Jan-09 10:13
EliottA5-Jan-09 10:13 
Question[Message Deleted] Pin
Vady_15-Jan-09 9:47
Vady_15-Jan-09 9:47 
AnswerRe: Hii Allll !!!! Pin
#realJSOP5-Jan-09 10:29
professional#realJSOP5-Jan-09 10:29 
GeneralRe: Hii Allll !!!! Pin
EliottA5-Jan-09 10:55
EliottA5-Jan-09 10:55 
GeneralRe: Hii Allll !!!! Pin
User 66585-Jan-09 11:22
User 66585-Jan-09 11:22 
GeneralRe: Hii Allll !!!! Pin
vaghelabhavesh5-Jan-09 13:02
vaghelabhavesh5-Jan-09 13:02 
JokeRe: Hii Allll !!!! Pin
Silvyster5-Jan-09 13:45
Silvyster5-Jan-09 13:45 
GeneralRe: Hii Allll !!!! Pin
#realJSOP5-Jan-09 23:45
professional#realJSOP5-Jan-09 23:45 
AnswerRe: Hii Allll !!!! Pin
Ravi Bhavnani5-Jan-09 17:41
professionalRavi Bhavnani5-Jan-09 17:41 
QuestionHow to Subclass Visual Controls Pin
JimWWhite5-Jan-09 6:53
JimWWhite5-Jan-09 6:53 
AnswerRe: How to Subclass Visual Controls Pin
led mike5-Jan-09 7:51
led mike5-Jan-09 7:51 
GeneralRe: OT Pin
Mark Salsbery5-Jan-09 12:41
Mark Salsbery5-Jan-09 12:41 
GeneralRe: OT Pin
led mike14-Jan-09 5:31
led mike14-Jan-09 5:31 
QuestionHow to learn machine name and username by using IP adress Pin
Sokka935-Jan-09 6:44
Sokka935-Jan-09 6:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.