About   -   Contact   -   Purchase   -   Search   -   What's New

Cannot Convert Any Error
If you have started working with distributed computing you will have seen the following message: Cannot convert any in Any variable to integer.

This message is normally generated because you made a distributed call to a function with a return value and the function failed. When your code is more thoroughly debugged the mean time between messages is less but they still occur on a regular basis. One of the design principle of our new class library was that just because a single window/Entity has a problem that cannot be resolved such as this, then the whole application should not suffer the consequences of a system error being generated. Instead just the part of the application with the problems should be shutdown.

Our way of dealing with the problem is that the pattern that is link to the distributed business entity should be shutdown (the windows will be closed), after giving the user a nice friendly message.

Prevention is the best solution for system errors, thus we needed a way to protect the patterns from ever generating this error. We have a single common interface between the pattern and the business entity, all calls to the business entity are generated by user interaction with patterns, these patterns make a service request which our interface knows how to consume.

Whenever we make a call to a distributed entity that returns a value, we accept the return value into an Any variable, then we check to see if the data type of the return value is the correct type (usually an integer). If the data type is correct then we cast it into the return value and continue processing. If the data type does not match then the business entity failed and the user is told about the problem, the pattern and distributed business entity are then closed.

This reason behind this is simple. If you export the syntax of a proxy you can see that all the arguments and return values are cast to an any before and after the call is made. Thus if the call fails the return value is not placed into the Any variable. So you are returned a Null Any variable, thus when you assign it to an integer or other type you get a visit from the system error!


Top of Page

Legal Notice

Ken Howe 2011