473,386 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

BUG: DeSerialization with empty byte array


I generated a Typed Dataset class including a base64Binary column. This
column was specified as a .NET type of Byte() in the class that was
auto-generated. I set the value of this property to New Byte() {} (i.e. Byte
array with zero elements) in a row of an instance of the class prior to
serialization using the binary formatter. When I attempt to DeSerialize the
instance, the following exception is thrown:

[System.Reflection.TargetInvocationException]:
{System.Reflection.TargetInvocationException}
Exception has been thrown by the target of an invocation.

I get around this exception by setting the value of the column to Nothing
(or Null in C#) instead of an empty byte array (New Byte() {}). What is the
problem with DeSerializing an empty byte array in this instance?

--------------------------------
Steps to reproduce bug
--------------------------------
1. Create a typed dataset with at least one column of type base64binary.
Let's call this column b64Binary. Let's call the dataset MyTypedDataset
2. Create a class with one of its properties as type MyTypedDataset
3. Create an instance of the class defined in step 2
4. Add a row to the MyTypedDataset property of the class, making sure to set
the value of the b64Binary column to 'New Byte() {}'. This is a byte array
with zero elements
4. Serialize the instance to memory or disk using the Binary Formatter
5. Now, attempt to DeSerialize the serialized instance. You should receive
the exception:

[System.Reflection.TargetInvocationException]:
{System.Reflection.TargetInvocationException}
Exception has been thrown by the target of an invocation.

My workaround is to set the b64Binary column to 'Nothing' if you're using
VB.NET, or Null if you're using C#.

Thanks,

Taiwo
Nov 20 '05 #1
1 6576
"Taiwo" <ta*****@hotmail.com> schrieb

I generated a Typed Dataset class including a base64Binary column.
This column was specified as a .NET type of Byte() in the class that
was auto-generated. I set the value of this property to New Byte() {}
(i.e. Byte array with zero elements) in a row of an instance of the
class prior to serialization using the binary formatter. When I
attempt to DeSerialize the instance, the following exception is
thrown:
Sorry to say that, but I think the description is better placed in a
languagte independent group (somewhere in
microsoft.public.dotnet.framework.*) as this

... to Nothing (or Null in C#) ...


statement also shows. Your good description is welcome for sure.
--
Armin

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stu | last post by:
Hi, Im reading a file in from disk as a byte array then passing it to a memory stream for decryption using crypto api functions. What I have found is that you need to reduce the array length by 2...
3
by: TEK | last post by:
There seems to be a bug when deserialization some classes in the .NET framework. If you try to deserialize a class that has a base class that holds a struct with a member that is implementing...
3
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I am having problems deserializing an object which seems to be serializing just fine. I save the byte array of the serialized object in the database...
2
by: Brian Keating | last post by:
Hello there, I wonder can anyone help point me in correct direction. Basically I have a Managed structure and I want to Serialize to to a byte array, Then I want to read this byte array in my...
3
by: Wild Wind | last post by:
Hello, I made a post relating to this issue a while back, but I haven't received any answer, so here I am again. I am writing a mixed C++ dll which uses the following declaration: typedef...
3
by: parrot toes | last post by:
Summary: I have been trying to make requests of a web service provided by Axis using a dotnet client with code generated by wsdl.exe and have been getting exceptions when trying to process the...
1
by: parrot toes | last post by:
I tried to post this question before, but there was an error when posting. I case it did get posted and in order to avoid duplication, I'll just repost a summary. I have written a dotnet client...
6
by: Marcus | last post by:
I have a couple of classes looking like this: ======================================== public class AdminSettingsData { public string adminSettingsPath; public string adminSettingsFile;...
0
by: Kurt B. Kaiser | last post by:
Patch / Bug Summary ___________________ Patches : 421 open ( +3) / 3530 closed ( +8) / 3951 total (+11) Bugs : 963 open ( +4) / 6426 closed (+21) / 7389 total (+25) RFE : 255 open...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.