hi,
Please refer this article because that is the dll iam using for
compression/decompression of datatables.
http://www.eggheadcafe.com/articles/20031219.asp
This is a windows application in C# & iam using remoting extensively
for my
database layer.
In the remote server iam having a method which returns byte[] instead
of
datatable using the compression logic mentioned in the article.
The code is below,
PAB.CompressDataSet.Wrapper objCompressData = new
PAB.CompressDataSet.Wrapper() return return
objCompressData.CompressDataTable(
objData.ExecQryRetDT("sp_name",CommandType.StoredP rocedure,colParams));
The above code returns a compressed byte array.
Now in the client side . i decompress it & convert it to datatable.
PAB.CompressDataSet.Wrapper objUnCompress = new
PAB.CompressDataSet.Wrapper();
DataTable
dtTable=objUnCompress.DecompressDataTable(obj.Exec QryRetDT("sp_name",CommandType.StoredProcedure,col Params));
It is during ths conversion i receive a serializationexception & that
too in
most machines. But in some machines it works for atleast one remoting
server. It is quite a strange thing.
THis compressdataset dll mentioned in the article does not have source
code
..
U can visit http://www.eggheadcafe.com/articles/20040311.asp
which has the source code fr ths dll
I even ran the source referencing ths new dll & i found out it is in
wrapper.cs class the exception is happenning & it is when the stream is
being deserialized using the compactformatter.cs.
This is the exact method where the error occurs
private object Deserialize(Stream Wire,ref Object parent) method
& at ths line
InnerList[i].SetValue(Answer,Deserialize(Wire,ref Temp));
Error Stack information is below,
"Object type cannot be converted to target type." }
[System.ArgumentException]: {"Object type cannot be converted to target
type." }
System.Object: {System.ArgumentException}
_className: null
_COMPlusExceptionCode: -532459699
_exceptionMethod: {undefined value>
_exceptionMethodString: null
_helpURL: null
_HResult: -2147024809
_innerException: { }
_message: "Object type cannot be converted to target type."
_remoteStackIndex: 0
_remoteStackTraceString: null
_source: null
_stackTrace: {System.Array}
_stackTraceString: null
_xcode: -532459699
_xptrs: 0
HelpLink: null
HResult: -2147024809
InnerException: { }
Message: "Object type cannot be converted to target type."
Source: "mscorlib"
StackTrace: " at
System.Reflection.RuntimeFieldInfo.InternalSetValu e(Object obj, Object
val,
BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean
requiresAccessCheck, Boolean isBinderDefault)\r\n at
System.Reflection.RuntimeFieldInfo.SetValue(Object obj, Object val,
BindingFlags invokeAttr, Binder binder, CultureInfo culture)\r\n at
System.Reflection.FieldInfo.SetValue(Object obj, Object value)\r\n at
Serialization.Formatters.CompactFormatter.Deserial ize(Stream Wire,
Object&
parent) in
F:\\Projects\\project_offline_compress\\CompressDa taSet\\CompactFormatter.cs:line
670"
TargetSite: {System.Reflection.RuntimeMethodInfo}
Can u please help me on this because i think some small mistake in the
compactformatter code is resultin in this error.
Let me know if u need any further information.
Thanks,
Pavan