Inconsistent Output from Custom C# Components on First Enable

I’m running into a strange issue with some custom C# components I’m developing in Visual Studio. On first enable, the component outputs a different result (e.g. 541 curves), but after disabling and re-enabling once, it jumps to a stable value (e.g. 817 curves) and stays consistent on subsequent runs.

There are no global/static variables in use, and I’m outputting a GH_Structure. I’m wondering if this might be a known issue or if there’s something specific in my code I should be looking at?

Happy to internalize data and share a minimal case if that helps. Appreciate any pointers or ideas!

I’ve never run into something like that before! Granted, I’ve only made custom components using the script editor and Rhino plugins using VS, but that inconsistency is odd. Without more info, it’s hard to troubleshoot. Posting the code would be very helpful, but before that, have you tried using Visual Studio’s debug features? You can trace data flow and peek on variable information. If the bug is consistent, I’d recommend starting there if you haven’t already.

It would be great if you can share an example I can test here and debug

Thanks @Cole_Howell1 and @eirannejad , I eventually figured it out :man_facepalming: I had a component further down the script that was changing the document tolerance, so the difference in output was due to the fact that the doc tolerance was different for the first run.

1 Like