473,326 Members | 2,173 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,326 software developers and data experts.

OptionalFieldAttribute is causing AugumentNullException on Deseria

I have an application that includes several serializable classes that are all
output using the SOAP formatter. Over the years, I've added several
OptionalFieldAttributes to various members of the classes.

Now, on one particular class I'm trying to add an additional
OptionalFieldAttribute, but when I deserialize the objects I get an
ArgumentNullException with a message of: "Member at position 22 was null."

I can move the new field to a different class and everything works just
fine. This error only happens in the single class where I need this new
attribute.

This is the 8th OptionalField to be added to the class. The actual code is
as follows:
<OptionalFieldAttribute(VersionAdded:=6)Private _Status As Integer

The top part of the stack trace includes the following:
at
System.Runtime.Serialization.FormatterServices.Pop ulateObjectMembers(Object
obj, MemberInfo[] members, Object[] data)
at
System.Runtime.Serialization.Formatters.Soap.ReadO bjectInfo.PopulateObjectMembers()
at
System.Runtime.Serialization.Formatters.Soap.Objec tReader.ParseObjectEnd(ParseRecord pr)
at
System.Runtime.Serialization.Formatters.Soap.Objec tReader.Parse(ParseRecord
pr)
at
System.Runtime.Serialization.Formatters.Soap.SoapH andler.EndElement(String
prefix, String name, String urn)
at System.Runtime.Serialization.Formatters.Soap.SoapP arser.ParseXml()
at System.Runtime.Serialization.Formatters.Soap.SoapP arser.Run()
at
System.Runtime.Serialization.Formatters.Soap.Objec tReader.Deserialize(HeaderHandler handler, ISerParser serParser)
at
System.Runtime.Serialization.Formatters.Soap.SoapF ormatter.Deserialize(Stream
serializationStream, HeaderHandler handler)
at
System.Runtime.Serialization.Formatters.Soap.SoapF ormatter.Deserialize(Stream
serializationStream)
at ... [my calling function]

I've found a similar post at
http://social.msdn.microsoft.com/For...-ce25f16af0e7/
that did not include a resolution to the problem either.

I'm trying to figure out how to handle this issue so I can serialize this
additional field correctly and handle previously saved data files.

Jason

Nov 1 '08 #1
3 2711
Hi Jason,

Thanks for using Microsoft Newsgroup Service. My name is Hongye Sun [MSFT]
and it is my pleasure to work with you on this issue.

After my research on this issue, I found that this issue as you described
can be caused by many possibilities and it is hard to tell what caused the
error right now. I need the serializable classes and the xml file that you
are testing on to do further troubleshooting. Can send them to my email
address (ho*****@online.microsoft.com, remove 'online.')?

Here is information for you to do troubleshooting on your side:
One possibility of the issue is caused by duplicate members in xml file. If
there are two fields with same name in xml file, the SOAP formatter is
unable to identify them and report the same exception as you reported.
The duplicate members may look like:
---------------------------------
<m_Image5 xsi:null="1"/>
<m_Image5 xsi:null="1"/>
---------------------------------
m_Image5 is one of the fields in the class.
Can you have a quick check of the xml file and verify that there is no
duplicate in all the members of the error class?

Thanks in advance for your cooperation and I will be waiting for your
reply. Have a nice day.

Regards,
Hongye Sun (ho*****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 3 '08 #2
Hello Jason,

Thanks for your reply email. The repro project is very useful for us to do
further troubleshooting.

I have done a deep research on the project and found the cause of the
problem, however, I haven't found the solution yet. I am writing to let you
know the progress of the issue and I will continue to work out a solution
for you. In the meanwhile, I will also consult this issue with product team.

The cause I found is that when a class has a structure field, the
OptionalFieldAttribute will stop working.

I tested it in our lab by setting the fields in the clsSystem class to
NonSerialized one by one and finally found that when mvarColor, which is
type "Color" structure, is set to NonSerialized, everything works fine. (I
also simplified the "ias" file.)

I also proved that by creating another new class with a field whose type is
a user defined structure. It reports me the same error.

Thanks again for your great cooperation. Have a nice day!

Regards,
Hongye Sun (ho*****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 10 '08 #3
You are welcome, Jason. It is my pleasure to work with you.

We are still verifying if this is a bug. I will continue to update the
progress of the issue in this thread. If you are not interested in the
further information, please feel free to let me know. I will close this
issue. Thanks.

Regards,
Hongye Sun (ho*****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
*
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 11 '08 #4

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

Similar topics

0
by: Jim C Nguyen | last post by:
I have a table with ~2.2 million rows. Sometimes when I do an update to one single row it will instead update ALL of the rows using the same update. This happens every one in about 500,000...
3
by: Sarah Haskins | last post by:
I have a few questions about this problem I'm having involving XML, DTD, and XSL. I'm working with this DTD which defines a stylesheet, as such... <?xml version="1.0" encoding="UTF-8"?>...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
11
by: Timothy Shih | last post by:
Hi, I am having a freezing issue with my application. My application serves several remotable objects, all of which must be initialized before their use. Furthermore, some of them depend on each...
10
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
1
by: D A H | last post by:
I have gotten the same exception in multiple projects. I have solved the underlying problem. My question is if anyone knew of a setting that would cause this exception to be thrown. A...
2
by: Rob Meade | last post by:
Hi all, We have recently adopted to using .net for our web applications which were previously written in vanilla ASP. Things have been going ok until recently, or at least its only recently...
0
by: Mel | last post by:
Hi, I have problem in using OptionalFieldAttribute when I serialized a class Srl using SoapFormatter. I am currently using .NET Framework 2.0 I have done something like this: public class...
0
by: cmdolcet69 | last post by:
When i use optionalfieldattributes in my software i get error messages following error message: Error Target - AddGraphicArrowsLimitsToScreen Error Message - Object reference not set to an...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.