Hi Dermot,
Your approach should work OK, as long as you’re not getting the threading and the timing wrong.
Can you give a bit more details about the crash from the event log?
I assume it’s an Access Violation or something, but it’s good to confirm.
One can go down the road of setting up MiniDumps from the crash, getting the Office symbols, and seeing if you can get a stack trace and other insights into the crash.
You could also work towards a minimal reproduction of the issue - if you can crash Excel reliably with reasonable code, you might be able to get some support or attention to the issue. Your update rate does not seem unreasonable to me.
How exactly does this part work: “Full Application.Calculate() occurs on configurable scheduler every 2-5 seconds.” ?
What is triggering this scheduled call, and how are you making sure it is made from the main thread, and happens at a time when Excel is not busy calculating?
Similar for the Range.Calculate call – how is that made?
Since you’re driving the whole calculation, it’s not clear what you win by doing the extra Range.Calculate calls and pulling the data in with the UDF.
You might as well write to a range, calculate and then read results back.
If you do want to move to a calculation-driven approach, you could re-engineer things like this.
* Create an IObservable<T> based UDF for the crypto feed. This is exposed to Excel as an RTD-base stream, where you have some control of the sheet update rate with Application.RTD.ThrottleInterval.
* Create some UDFs that basically monitor outputs – it might write to an output file or buffer of some sort, and gets called as part of the sheet calculation, meaning you don’t have to read the sheet to get calculation results.
* Run the sheet in automatic recalculation mode.
* Note that you’re not guaranteed that Excel will fetch and calculate with every value in the input stream (with extra work, Excel-DNA allows some ways to ensure this). But that does not seem to be what you’re doing currently anyway.
I’m not sure this would perform better or be more stable, but it seems a bit more sympathetic to Excel.
Let me know if you have any questions or get more insight into the crash.
-Govert
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/exceldna/a177ad3b-6afd-4279-89ad-752ce63bc3c8n%40googlegroups.com.