'System.SerializableAttribute' - CF 2.0

  • Thread starter Thread starter Hugh Janus
  • Start date Start date
H

Hugh Janus

OK, I am trying to serialise an XML file. I have added the schema to
my project and run the below command.

xsd XMLFile.xsd /classes /language:vb /namespace:XMLFile


When I open the outputted .vb file in VS 2005 I get the following error

"Type 'System.SerializableAttribute' is not defined." on the line:


<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "2.0.50727.42"),

_
System.SerializableAttribute(), _


This works on the 'normal' framework but I am programming using the
compact framework. I don't know if the class is missing, is in a
different place or what. Anyone know how to fix this? I am using VB
2005.


Thanks,
Hugh
 
Hugh said:
This works on the 'normal' framework but I am programming using the
compact framework. I don't know if the class is missing, is in a
different place or what. Anyone know how to fix this? I am using VB
2005.

The type 'System.SerializableAttribute' is not supported in the Compact
Framework in versions prior to 2.0.

Ebbe
 
The type 'System.SerializableAttribute' is not supported in the Compact
Framework in versions prior to 2.0.

Ebbe

Thanks, I am using VB.Net 2005 which uses the 2.0 framework. So why
can I not find 'System.SerializableAttribute'? Has it been moved or do
I need it reference anything extra? What do I need to do to get this
working?

Also, could it be that I did not use the CF version of the xsd command
(if one exists)??

Hugh
 
It's added in V2 SP1. Keep in mind this attribute has absolutely no effect
on NETCF and only added for better desktop compatibility.

XML serialization does not use or need it; it's only used by binary
serializer which is not available on NETCF.



Also, I'm not sure what you mean by "I am trying to serialise an XML file".
Files/streams is the product of serialization, not serialization object.

E.g. you're serializing class into XML file.


--
Best regards,

Ilya

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

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Ilya said:
It's added in V2 SP1. Keep in mind this attribute has absolutely no effect
on NETCF and only added for better desktop compatibility.

XML serialization does not use or need it; it's only used by binary
serializer which is not available on NETCF.

Also, I'm not sure what you mean by "I am trying to serialise an XML file".
Files/streams is the product of serialization, not serialization object.

E.g. you're serializing class into XML file.

OK, thanks. I guess I got the terminology wrong. What I want to do is
build a set of classes based on the schema of my xml file. So I used
the xsd command (as per instructions I am following on the web) and the
outputted file had the following at the top:

<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.42"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _

System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.topografix.com/GPX/1/1"),
_
System.Xml.Serialization.XmlRootAttribute("gpx",
[Namespace]:="http://www.topografix.com/GPX/1/1", IsNullable:=False)> _
Partial Public Class gpxType

This works fine if my project is a VB app, but when I add it to my
compact framework VB app, it does not like the
System.SerializableAttribute() part. This is something I haven't done
before so consequently I am a bit stuck on how to fix it. What do I
need to change to get this working?

Also, when is V2 SP1 out? Would installing this solve my problems or
should I use something other than System.SerializableAttribute() ?

Thank,
Hugh
 
SP1 shipped couple months ago.



You also can remove this attribute:



<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd","2.0.50727.42"), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _





By the way, I suspect you're trying to do something like this and that won't
work:



http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=750942&SiteID=1



--
Best regards,

Ilya

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

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

Hugh Janus said:
Ilya said:
It's added in V2 SP1. Keep in mind this attribute has absolutely no
effect
on NETCF and only added for better desktop compatibility.

XML serialization does not use or need it; it's only used by binary
serializer which is not available on NETCF.

Also, I'm not sure what you mean by "I am trying to serialise an XML
file".
Files/streams is the product of serialization, not serialization object.

E.g. you're serializing class into XML file.

OK, thanks. I guess I got the terminology wrong. What I want to do is
build a set of classes based on the schema of my xml file. So I used
the xsd command (as per instructions I am following on the web) and the
outputted file had the following at the top:

<System.CodeDom.Compiler.GeneratedCodeAttribute("xsd",
"2.0.50727.42"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _

System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.topografix.com/GPX/1/1"),
_
System.Xml.Serialization.XmlRootAttribute("gpx",
[Namespace]:="http://www.topografix.com/GPX/1/1", IsNullable:=False)> _
Partial Public Class gpxType

This works fine if my project is a VB app, but when I add it to my
compact framework VB app, it does not like the
System.SerializableAttribute() part. This is something I haven't done
before so consequently I am a bit stuck on how to fix it. What do I
need to change to get this working?

Also, when is V2 SP1 out? Would installing this solve my problems or
should I use something other than System.SerializableAttribute() ?

Thank,
Hugh
 
Back
Top