Grasshopper

algorithmic modeling for Rhino

Hi,
Does anyone have any guidance as to how to start debugging a "Script Exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

Besides commenting each line one by one and seeing where it crashes, I haven't found a better way to debug. Any suggestions?

Thanks.

Views: 398

Replies to This Discussion

Hi Chok, it mostly happens because of a Null passed to a RhUtil method, especially if you use a method with an "arguments" object (args). Just check that you always assign a value to the important properties, and if you still have some questions, please post the script as text on the forum.
______________________________________________________________________
Giulio Piacentino - giulio@mcneel.com
McNeel Europe - Barcelona
Hi Kermin,
In general, here are few things you might try:

1- Write incremental code. That is, try to test your code before it is too long and hard to debug. if you can isolate small functionalities and test them incrementally, then there is a good chance you end up with more robust code.

2- Assign meaningful variable names and comment as you suggested.

3- Use Subs and Functions when you can and test those.

4- Use "Print" function to output results and track possible problem areas.

5- If you write complex code, then you can use Visual Studio Express to write and debug your code before bringing it to GH. You can find many resources here:
http://en.wiki.mcneel.com/default.aspx/McNeel/Rhino4DotNetPlugIns.html

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service