API code crashes

Dec 27, 2004 2 Replies

I'm using SW2004 SP4.1 & VB.NET 7.1.3088. I have written a program that opens several SW drawings and reports some information to an excel spreadsheet. Sometimes the code functions correctly, sometimes it crashes. The crashes occur in different parts of the code (always on a SolidWorks function call).



Does anyone have any suggestions for things that might be causing the crashes? Are there any best-practices that I might be missing?



Thanks.



Can you post some of your code and where it crashes?

I crash SW regularly while using both VB and VB.NET, but it is usually b/c I am asking it to do something it does not like to do. I have found them both to be very stable in production.

Evan

Evan, thanks for the reply. The code crashes on lines such as these (these are examples, not my entire code):

bStatus = oDrawingModel.ShowConfiguration2(sConfigName) oDrawingView = oSwDrawing.GetFirstView() oSolidWorksApplication.CloseDoc(sConfigName & ".slddrw")

The error I usually get is: An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in microsoft.visualbasic.dll Additional information: The server threw an exception.

Using the same test scenarios, it sometimes works, and sometimes crashes. Any ideas?

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required