Grasshopper

algorithmic modeling for Rhino

Hi,

I am writing some simple functions in .dll file and referencing it to c# component editor in grasshopper.

I usually change code in Visual Studio, then build it or press continue.

But the updated .dll has the same old code. To solve this I have to restart Rhino.

Is there is a workaround without restarting Rhino?

Thanks

Views: 2086

Replies to This Discussion

No, once loaded a dll remains the same within an AppDomain. You must terminate the domain (restart rhino) in order to overwrite a dll and load it anew.

Thank you for explanation.

I was wondering that it is possible to run .dll on grasshopper c# debugger/component.

But it is not, do you have an advice how to debug the code in this way. Should I write some code I want to debug in try catch statement?

And Coff settings are used to reference .gha file from folders in other locations thant libraries folder?

That should be possible. You must set your project to debug by starting an external application (in this case Rhino.exe), and then when your dll gets loaded your debugger will handle it.

If you're using Visual Studio express you may need to edit the project files by hand, as it doesn't expose debugger options in the UI.

Hi,

I made these steps and I cannot have updated code on the fly:

1. I have a static classes with 1 variable  such as public static int a = 0 in Visual Studio Professional;

2. I changed the debug application to Rhino.Exe.

3. Press Start.

4. Rhino is opening and I open grasshopper.

5. I add native grasshopper c# component and reference .dll

6. I have an access to static variable.

then what I want to do but I can't:

7. I stop the debugger in visual studio and add one more variable and expect that the library would be updated as is when I compile gh components.

8. But when I press continue and  the .dll file is not updated and I do not see any additional variables declared. First I thought ok, maybe it is not visible, but I typed a correct name, but the message says that my dll does not contain this type.

9. Then I tried to reference the .dll again, but nothing happens, same old .dll is referenced.

10. When I close and open rhino it is updated. The whole closing and opening operation is a bit disturbing and I would like to debug it via Visual Studio.

Do you know what I doing wrong?

Is it working like so, because .dll is loaded to memory and not referenced from Hard Drive?

I've never been able to edit code while debugging. Some people claim it is supposed to work but I sure can't figure out how.

You can change the values of existing variables from within breakpoints in the debugger, but you can't change the logic of your program.

If you pause the debugger, you can make some very local changes. 

You CAN'T change/add class-level variables, methods etc. 

But within each method you can add/remove code, you can even pause a For loop in the middle of the execution and change the i value. Therefore, you sort of can change the logic of the program, but only in a very local scope.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service