10-05-2017 08:21 AM
hi,
we have developed a dll of publish- subscriber messaging service using our customized tcp protocol. Whenever we receive a message, we are getting an exception of deserialization problem and teststand gets crashed. We debugged the issue with visual studio and found that "it is unable to find out type of object...so and so (sorry its company's confidential thing).
We faced the same issue in Labview. Then We kept the dependent dll in the labview project folder. This solved our issue.
But I am unable to solve this issue in Teststand.I would be grateful if someone could help me. Here I have shared a screenshot of the error..have a look
10-06-2017 08:53 AM
Do you have multiple appdomains involved? Are you sharing a .NET object between TestStand and LabVIEW? What versions of TestStand and LabVIEW are you using?
Based on the error you are getting it sounds like the problem is that an exception object is being thrown across appdomains, but that object (your's?) is not correctly implemented to support this (it must be serializable for this to work). Here's an example of how to implement an exception object that supports serialization:
[Serializable]
public class MyExceptionClass : Exception
{
private readonly int _errorCode;
public MyExceptionClass(int errorCode)
{
_errorCode = errorCode;
}
public MyExceptionClass(string message, int errorCode) : base(message)
{
_errorCode = errorCode;
}
public MyExceptionClass(string message, Exception innerException, int errorCode)
: base(message, innerException)
{
_errorCode = errorCode;
}
// Needed so that deserialize works when passing object across appdomain boundries.
[SecuritySafeCritical]
protected MyExceptionClass(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_errorCode = info.GetInt32("MyExceptionClass._errorCode");
}
// Needed so that deserialize works when passing object across appdomain boundries.
[SecurityCritical]
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("MyExceptionClass._errorCode", _errorCode);
// Let base class do its work.
base.GetObjectData(info, context);
}
}
Hope this helps,
-Doug