I have a simple service that uses the following type:
[Description("UserData holds information about a user")]
public class UserData : RemObjects.SDK.Types.ComplexType
{
[Description("lName user last name")]
public string lName { get; set;}
[Description("fName user first name")]
public string fName { get; set; }
[Description("userID user ID number")]
public string userID { get; set; }
[Description("myEnum enum of user capibilities")]
public MyEnum myEnum { get; set; }
[Description("hotelCode string array of hotel codes")]
public string[] hotelCodes { get; set; }
public decimal decimalTest { get; set; }
}
This type is returned with the following service method:
[ServiceMethod, Description("DoSomething returns UserData")]
public UserData DoSomething(UserData s)
{
s.userID = "123";
s.myEnum = MyEnum.Two;
s.hotelCodes = new string[2] { "Hotel1", "Hotel2" };
s.decimalTest = 3.14M;
return s;
}
When called I get the an error in my _inf file at this location:
else {
decimalTest = serializer.ReadDecimal("decimalTest"); <<<+++ exception
fName = serializer.ReadUtf8String("fName");
hotelCodes = ((string[])(serializer.Read("hotelCodes", typeof(string[]), RemObjects.SDK.StreamingFormat.Utf8String)));
lName = serializer.ReadUtf8String("lName");
The exceptions details are:
System.ArgumentException was unhandled
HResult=-2147024809
Message=Decimal byte array constructor requires an array of length four containing valid decimal bytes.
Source=mscorlib
StackTrace:
at System.Decimal.SetBits(Int32[] bits)
at RemObjects.SDK.BinSerializer.ReadDecimal(String name)
at TestCodeFirst.UserData.ReadComplex(Serializer serializer) in D:\Projects\Dot.Net\TestCodeFirstClient\TestCodeFirstClient\TestCodeFirst_Intf.cs:line 103
at RemObjects.SDK.Serializer.ReadComplexData(ComplexType value)
at RemObjects.SDK.Serializer.ReadComplex(String name, Type type)
at RemObjects.SDK.Serializer.Read(String name, Type type, StreamingFormat format)
at RemObjects.SDK.Message.Read(String name, Type type, StreamingFormat format)
at TestCodeFirst.Service1_Proxy.DoSomething(UserData s) in D:\Projects\Dot.Net\TestCodeFirstClient\TestCodeFirstClient\TestCodeFirst_Intf.cs:line 415
at TestCodeFirstClient.Form1.button1_Click(Object sender, EventArgs e) in D:\Projects\Dot.Net\TestCodeFirstClient\TestCodeFirstClient\Form1.cs:line 52
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at TestCodeFirstClient.Program.Main() in D:\Projects\Dot.Net\TestCodeFirstClient\TestCodeFirstClient\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
I can create a service method that returns a single decimal or an array of decimal with no problem. But I get the exception when it is a property of a RemObjects.SDK.Types.ComplexType
This is with VS 2015 update 2, latest production RemoteSDK using codefirst.
Thanks Mike