Bug: Logos 4 API exception accesing LogosPanel.Details
Hi,
Something for the Logos Developers please. Context https://wiki.logos.com/Logos_4_COM_API
Firstly, I'm pleased that the Logos 4 COM API is still in the product, and was not silently dropped, in case I'm one of the last three people still using it or something ...
My PC: Windows 10 Pro 64 bit, Anniversary Update, Version 1607 (OS Build 14393.222)
Logos: 7.1.0.0025
Using Microsoft Visual Studio Pro 2015, Update 3.
Programming in VB.Net and using fresh code I'm rewriting, to try and pick up a "master plan" I began working on 3 or 4 years ago ...
Leaving aside all the Control.InvokeRequired() nightmares if wanting to write something during the LogosApplication Event Handlers ... which I now have working.
My issue is that a simple button on the main VB.Net Form to call LogosApplication.ListPanels() is unable to obtain the LogosPanel.Details object. (Same issue within the LogosApplication.PanelChanged event.)
The error displayed within the debugger, including if I stop at a breakpoint to inspect a Panel object is:
Details = {System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
--- End of inner exception
The debugger knows that Panel is a system.__ComObject
To be clear, this is both during an event handler of the LogosApplication object, but also a simple Form.Button Click handler calling ListPanels and attempting to inspect each Panel.
The Button Click code in question is as follows:
For Each panel In app.GetOpenPanels()
PanelDecode(panel)
Next
So my question please:
Is this a bug in the current release of Logos 7, or in my code, or something about how Windows 10 and COM support now works, or something else?
I'm guessing Microsoft changed something about how Windows 10 is permitted (or NOT) to reach back to something in COM.
Thanks, and sorry to those who have little idea about everything above.
Regards,
Jim
Comments
-
JimTowler said:
Is this a bug in the current release of Logos 7
Yes.
I have created an internal bug report.
0 -
This should be fixed in Logos 7.2 Beta 1. I don't think there's any workaround until then (except for avoiding the Details property).
0 -
Bradley,
Thank you for that, and the quick feedback too.
I'll work on other areas of my program while waiting for that new beta release.
One side effect was I got to check my code and sort out the various threads, as I worked to debug the issues.
I some learnt my code running in LogosApplication.PanelChanged() event handler was all in different threads as I had many overlapping ones fire at the same time, and not the same as the main VB UI thread of course. I'll need to queue anything I need from those events back into the main UI thread, and insure any objects I use are thread-safe!
Regards,
Jim
0 -
Jim,
This should now be fixed in 7.2 Beta 1, can you please verify and report back?
0 -
Thank you.
YES - confirmed fixed.
(I now get a valid object that I can cast to a LogosResourcePanelDetails, then obtain the ResourceId string. This is working now.)
Now on to remember why I needed that, and what its useful for ... [:P]
0 -
Anyone bored and still reading ...
In Microsoft .NET, there is a collections class called ConcurrentQueue which claims to be thread-safe.
So you can make a ConcurrentQueue(Of Type) and use it between event handlers and the main UI thread etc as needed.
So in Visual Basic ...
Imports System.Collections.ConcurrentPrivate myLogosQ As New ConcurrentQueue(Of LogosInfo)
Now back to attempting to do something Logos 7 does not already do all by itself and still needs my help ...
0