Hi, I use in my plugin the “SelectedViewChangedIndication” message.
In the associated method, I get the list of active monitors (_windowList = Configuration.Instance.GetItemsByKind (Kind.Window);).
Opening a floating window does not cause any problems. But when I close the floating window again, this line generates the error “Object reference not set to an instance of an object.”.
Why is that? It should then actually read the list without the floating window.
When I test with the Message Tester tools plugin sample I do not see an exception.
Can I persuade you to test with that plugin and see whether it works for you?
If it works you can compare your code with the sample’s code.
https://doc.developer.milestonesys.com/html/index.html?base=samples/messagetester_sample.html&tree=tree_1.html
Hello Bo,
I think the message sample does not help here.
I am working here in a background plugin and find in the sample
I do not use the functions I use:
_obj_1 = EnvironmentManager.Instance.RegisterReceiver (
_new MessageReceiver (GetCountActualView),_
_new MessageIdFilter (MessageId.SmartClient.SelectedViewChangedIndication));_
and
private object GetCountActualView (Message message, FQID destination, FQID sender)
_{_
_try_
_{_
**_\_windowList = Configuration.Instance.GetItemsByKind (Kind.Window);_**
_\_windowCount = \_windowList.Count;_
_if (message.Data! = null && (message.Data as Item) .FQID.Kind == child.view)_
_{_
_\_viewAndLayoutItem = message.Data as ViewAndLayoutItem;_
_\_countActualView = \_viewAndLayoutItem.Layout.Length;_
_}_
_}_
_catch (Exception ex) {}_
_return zero;_
_}_
The code > _windowList = Configuration.Instance.GetItemsByKind (Kind.Window); < generates the error. The “GetCountActualView” method is called twice when the floating window is closed, the first time without errors (but still reads the floating window), and the second time I get the error “Object reference not set to an instance of an object”.
I now reproduced the behavior. I will raise an investigation with Milestone Development.
Hotfix for the Smart Client fixes the error.
The following problem that the list, after closing the floating window, still contains the closed window, I have solved with a timer.