Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Setting a conditional break point when an object becomes unavailable

Posted on 2006-06-01
13
Medium Priority
?
196 Views
Last Modified: 2011-09-20
I would like to set a break point when an instance of excell is dropped.  I am trying to debug a problem when using interop services.  I am inserting a sheet into a workbook and with out warning the exell instance is dropped.
Any suggestions?
0
Comment
Question by:D2B
  • 6
  • 3
10 Comments
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 16806755
debug.assert (Excel)
0
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 16806770
Debug.Assert  breaks code only if the return value is false or nothing
0
 

Author Comment

by:D2B
ID: 16806913
Corey2
Can you help me through the set up.  I am not sure where to set or what to do with debug.assert
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:D2B
ID: 16807009
Corey I am using the excell interopservices.  It looks like when I insert a page the reference gets lost.  The Ecell Process in task manager in dropped and I get an RPC unavailable.  
Do you know if there is cashing going on when using interop services.  I ask this since there error I get is inconsistant.  Yes I get the RPC error but it happens at different times in the process.  

Basicall I am creating a report.  If the client has multiple divisions I insert a sheet and report on that division.  I can run small clients with multiple divisions.  (about 60 employees total) when I hit a client with 90 plus employees I get the error but it is inconsistant as to where it fails.  

Got any suggestions?

I have points
thanks in advance for the help
0
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 16807116
There are many things that can cause this kindof thing to happen.  I noticed it alot when I was running out of system resources. (not ram, but DeskTop Resources).  It could also be a bugged call to excel that is causing excel to crash.  I would suggest adding the debug.Assert line a few places in your code so you can narrow dow exactly where the process is getting killed.

If it is inconsistent make sure you are releasing and garbage collecting all COM objects, and close any windows that you are finished with.  They will maintain a windows handle until they are closed and possibly cause you to get an out of memory error.
0
 

Author Comment

by:D2B
ID: 16807174
I can and have been pretty good at releasing objects.  What would I need to do to check the garbage collecting of Com Objects?  I am not using this interopservices on another server but on the desk top.  
I have narrowed it down I believe.  It is when am insertig a work sheet.   I insert a worksheet.  then at inconsistant times I crash.

As for the Debug.assert should I just put it in the code at different place in the process? do I need to set anything else?

0
 
LVL 13

Accepted Solution

by:
Corey Scheich earned 1000 total points
ID: 16808376
You need to make sure you set Com objects to nothing so they can be garbage collected.

Yes Put it at different places and then you will know the error was between the 3rd Debug.Assert and the 2nd one for example.  Then you can add more between them to narrow it down further.
0
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 17001116
The OP made no further comments after my last comment leading me to believe his problem was solved
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 1000 total points
ID: 17016685
You need to use Marshal.ReleaseComObject(object) to release COM objects.  Setting them to Nothing won't help.

Bob
0
 
LVL 13

Expert Comment

by:Corey Scheich
ID: 17020568
Thanks for that Bob I was always a little skeptical about what was actually supposed to happen.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question