Select to view content in your preferred language

Works in Debug Mode, not in Run Mode

821
5
10-15-2010 11:39 AM
AultonSmith
Deactivated User
I am working on a macro in VB6 which works fine in Debug mode as long as I am stepping through it (10 - 15 minutes if I want to), but it crashes instantly whenever I go into Run mode.  I don't get a VB or ArcObjects error message, ArcMap crashes and I get the "Please tell ESRI about this problem" message.  Any clue? Thanks
0 Kudos
5 Replies
RichardWatson
Deactivated User
Try debugging the crash in Visual Studio.  Hopefully, the stack trace will show you the source of the crash.  You can either run ArcMap from Visual Studio or attach it to the ArcMap process.

Make sure that you generate debugging symbols for your VB6 DLL.
0 Kudos
AultonSmith
Deactivated User
Thanks for the reply, Richard, but I'm afraid it's a bit over my head.  I may have worded my question poorly.  I am actually working in VBA directly in ArcMap and maybe I should have said "break mode" instead of "debug mode".  In any case, are you suggesting I export my macro to a .dll and try to run it that way.  Can you post a link to a source on how to run ArcMap from VisualStudio or attach it to the ArcMap process?  I would be much obliged.
Aulton Smith
0 Kudos
AultonSmith
Deactivated User
It looks as if I have solved the problem.  I isolated it by moving my breakpoint up and down one line at a time (not the most elegant solution, I admit).  The offending line was:

Set pEnumSplitPoint = pPolyCurve.SplitAtDistances(1, dblMidPoint, True, False)

I had acquired this bit of code online somewhere, either from a forum post or a documentation sample, but in either case, it turned out to be faulty.  The 3rd argument (asRatios) should have been False.  I spent an entire day fruitlessly trying to find out what asRatios means.  Does anyone know?
0 Kudos
JonHall
Frequent Contributor
...what asRatios means...?


The distance you provide is either a distance in map units (i.e. 100 Feet along the polycurve) or a ratio (i.e. 0.5 would be 50% along the polycurve, splitting it in half)
0 Kudos
AultonSmith
Deactivated User
Thanks, Jon.  So, I can see how, if your distance argument is > 1 and asRatios is True, that could can cause a problem...
Aulton Smith
0 Kudos