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.CompressDat aSet.Wrapper objCompressData = new
PAB.CompressDat aSet.Wrapper() return return
objCompressData .CompressDataTa ble(
objData.ExecQry RetDT("sp_name" ,CommandType.St oredProcedure,c olParams));
The above code returns a compressed byte array.
Now in the client side . i decompress it & convert it to datatable.
PAB.CompressDat aSet.Wrapper objUnCompress = new
PAB.CompressDat aSet.Wrapper();
DataTable
dtTable=objUnCo mpress.Decompre ssDataTable(obj .ExecQryRetDT(" sp_name",Comman dType.StoredPro cedure,colParam s));
It is during ths conversion i receive a serializationex ception & 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 compactformatte r.cs.
This is the exact method where the error occurs
private object Deserialize(Str eam Wire,ref Object parent) method
& at ths line
InnerList[i].SetValue(Answe r,Deserialize(W ire,ref Temp));
Error Stack information is below,
"Object type cannot be converted to target type." }
[System.Argument Exception]: {"Object type cannot be converted to target
type." }
System.Object: {System.Argumen tException}
_className: null
_COMPlusExcepti onCode: -532459699
_exceptionMetho d: {undefined value>
_exceptionMetho dString: null
_helpURL: null
_HResult: -2147024809
_innerException : { }
_message: "Object type cannot be converted to target type."
_remoteStackInd ex: 0
_remoteStackTra ceString: null
_source: null
_stackTrace: {System.Array}
_stackTraceStri ng: null
_xcode: -532459699
_xptrs: 0
HelpLink: null
HResult: -2147024809
InnerException: { }
Message: "Object type cannot be converted to target type."
Source: "mscorlib"
StackTrace: " at
System.Reflecti on.RuntimeField Info.InternalSe tValue(Object obj, Object
val,
BindingFlags invokeAttr, Binder binder, CultureInfo culture, Boolean
requiresAccessC heck, Boolean isBinderDefault )\r\n at
System.Reflecti on.RuntimeField Info.SetValue(O bject obj, Object val,
BindingFlags invokeAttr, Binder binder, CultureInfo culture)\r\n at
System.Reflecti on.FieldInfo.Se tValue(Object obj, Object value)\r\n at
Serialization.F ormatters.Compa ctFormatter.Des erialize(Stream Wire,
Object&
parent) in
F:\\Projects\\p roject_offline_ compress\\Compr essDataSet\\Com pactFormatter.c s:line
670"
TargetSite: {System.Reflect ion.RuntimeMeth odInfo}
Can u please help me on this because i think some small mistake in the
compactformatte r code is resultin in this error.
Let me know if u need any further information.
Thanks,
Pavan