Problem Retrieving Data from DataAbstract Appserver

https://www.screencast.com/t/3md5Px1n

Hi,

v9.3.105.1345

Error Message:

“Object cannot be stored in an array of this type.”

Stack Trace:

at System.Array.InternalSetValue(Void* target, Object value)
at System.Array.SetValue(Object value, Int32 index)
at RemObjects.SDK.BinSerializer.ReadArray(String name, Type type, StreamingFormat format)
at RemObjects.SDK.Message.Read(String name, Type type, StreamingFormat format)
at Chronicle.DataAccess.Remote2.FileTransferService_Proxy.GetDirectory(String FullPath) in C:\Users\Me\Documents\GitHub\Chronicle-Svr-Utilities\Chronicle.MultiPartDownload\Chronicle_DataAccess_Remote2_Intf.cs:line 12296
at Chronicle.MultiPartDownload.MultipartDownload.GetDirectoryData() in C:\Users\Me\Documents\GitHub\Chronicle-Svr-Utilities\Chronicle.MultiPartDownload\MultipartDownload.cs:line 100

My Class:

namespace Chronicle.Base.Types
{
    [System.Reflection.ObfuscationAttribute(Exclude = true)]
    public class TFileInfo : RemObjects.SDK.Types.ComplexType
    {
        private string @__FileName;
        private long @__Size;
        private string @__TypeName;
        [RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
        public virtual string FileName
        {
            get
            {
                return @__FileName;
            }
            set
            {
                @__FileName = value;
                this.TriggerPropertyChanged("FileName");
            }
        }
        public virtual long Size
        {
            get
            {
                return @__Size;
            }
            set
            {
                @__Size = value;
                this.TriggerPropertyChanged("Size");
            }
        }
        [RemObjects.SDK.StreamAs(RemObjects.SDK.StreamingFormat.AnsiString)]
        public virtual string TypeName
        {
            get
            {
                return @__TypeName;
            }
            set
            {
                @__TypeName = value;
                this.TriggerPropertyChanged("TypeName");
            }
        }
    }
}

Thanks for your help!
Todd

It seems that the type TFileInfo is defined in more than one assembly referenced by your application. This usually happens when _Intf file is imported in more than 1 of the referenced projects and assemblies.

In .NET if one defines a type Chronicle.Base.Types.TFileInfo in 2 subprojects P1 and in subproject P2 then .NET considers there 2 type definitions as a completely different types.

However when a method call result is being read and SDK needs to create an instance of type TFileInfo it has no information which exactly type should it use - the one defined in P1 or the one defined in *P2. This eventually result in exactly the same exception that you have.

The solution is to move _Intf servce file to a separate project/assembly and use this assembly in client projects instead of direclty importing _Inth file into aech project.

Regards

Anton Thanks!

That was a rookie mistake. On the client end I used my Chronicle.Base.dll in the same project as my .intf file.

Different question was the video helpful?

Sincerely,

Todd