|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
BUG: Strongly-typed DataTable GetSchemaSerializable methodI've created a strongly-typed DataSet that contains one DataTable. My intent is to return this DataTable from a WebService that will be consumed by a Windows Form. In my windows application, when I add a reference to the Web Service, the proxy code that is generated in the Reference.vb file throws the following errors: "sub 'ReadXmlSerializable' cannot be declared 'Overrides' because it does not override a sub in a base class." AND "Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema' cannot override 'Protected Overridable Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema' because they differ by their return types." I can workaround this by removing the overrides directive from these methods, but a warning is then generated saying they should be marked with the overrides directive. I was having this problem earlier today in the Designer.vb file associated with the .xsd file of my DataSet before the WebService project was added to the solution and got rid of it by deleting everything and starting with a fresh solution and recreating my strongly-typed DataSet. I'm a bit farther along in the solution this time, so starting over again is not an option. In the meantime I can live with the warnings, but I have about 20 or 30 more strongly-typed DataSets and DataTables to create, so a fix for this would be great. Thanks. Hello,
Did you work with VS.NET 2003 or 2005? I create a test solution in VS.NEt 2005, but I didn't find the problem when there is following code in the Reference.vb file: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _ Protected Overrides Sub ReadXmlSerializable(ByVal reader As System.Xml.XmlReader) If (Me.DetermineSchemaSerializationMode(reader) = System.Data.SchemaSerializationMode.IncludeSchema) Then Me.Reset Dim ds As System.Data.DataSet = New System.Data.DataSet ds.ReadXml(reader) If (Not (ds.Tables("Table1")) Is Nothing) Then MyBase.Tables.Add(New Table1DataTable(ds.Tables("Table1"))) End If Me.DataSetName = ds.DataSetName Me.Prefix = ds.Prefix Me.Namespace = ds.Namespace Me.Locale = ds.Locale Me.CaseSensitive = ds.CaseSensitive Me.EnforceConstraints = ds.EnforceConstraints Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) Me.InitVars Else Me.ReadXml(reader) Me.InitVars End If End Sub Luke Zhang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Hi Luke,
I'm using VS 2005, and here are the two methods that are giving the error message in the Reference.vb file that I have, let me know if you want me to send you full source code: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _ Protected Overrides Sub ReadXmlSerializable(ByVal reader As System.Xml.XmlReader) If (Me.DetermineSchemaSerializationMode(reader) = System.Data.SchemaSerializationMode.IncludeSchema) Then Me.Reset() Dim ds As System.Data.DataSet = New System.Data.DataSet ds.ReadXml(reader) If (Not (ds.Tables("CdInsurance")) Is Nothing) Then MyBase.Tables.Add(New CdInsuranceDataTable(ds.Tables("CdInsurance"))) End If Me.DataSetName = ds.DataSetName Me.Prefix = ds.Prefix Me.Namespace = ds.Namespace Me.Locale = ds.Locale Me.CaseSensitive = ds.CaseSensitive Me.EnforceConstraints = ds.EnforceConstraints Me.Merge(ds, False, System.Data.MissingSchemaAction.Add) Me.InitVars() Else Me.ReadXml(reader) Me.InitVars() End If End Sub <System.Diagnostics.DebuggerNonUserCodeAttribute()> _ Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream Me.WriteXmlSchema(New System.Xml.XmlTextWriter(stream, Nothing)) stream.Position = 0 Return System.Xml.Schema.XmlSchema.Read(New System.Xml.XmlTextReader(stream), Nothing) End Function Show quote "Luke Zhang [MSFT]" wrote: > Hello, > > Did you work with VS.NET 2003 or 2005? I create a test solution in VS.NEt > 2005, but I didn't find the problem when there is following code in the > Reference.vb file: > > <System.Diagnostics.DebuggerNonUserCodeAttribute()> _ > Protected Overrides Sub ReadXmlSerializable(ByVal reader As > System.Xml.XmlReader) > If (Me.DetermineSchemaSerializationMode(reader) = > System.Data.SchemaSerializationMode.IncludeSchema) Then > Me.Reset > Dim ds As System.Data.DataSet = New System.Data.DataSet > ds.ReadXml(reader) > If (Not (ds.Tables("Table1")) Is Nothing) Then > MyBase.Tables.Add(New > Table1DataTable(ds.Tables("Table1"))) > End If > Me.DataSetName = ds.DataSetName > Me.Prefix = ds.Prefix > Me.Namespace = ds.Namespace > Me.Locale = ds.Locale > Me.CaseSensitive = ds.CaseSensitive > Me.EnforceConstraints = ds.EnforceConstraints > Me.Merge(ds, false, System.Data.MissingSchemaAction.Add) > Me.InitVars > Else > Me.ReadXml(reader) > Me.InitVars > End If > End Sub > > Luke Zhang > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > > Thank you for the information. In your reference.vb, is the proxy class
definition like: Partial Public Class Service Inherits System.Web.Services.Protocols.SoapHttpClientProtocol Also, in the referece list of current winform project, right click the "system.web.services" and select properties, is its version "v2.0.50727"? And its path is "\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll" Luke Zhang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Hi Luke,
Yes to both questions. Show quote "Luke Zhang [MSFT]" wrote: > Thank you for the information. In your reference.vb, is the proxy class > definition like: > > Partial Public Class Service > Inherits System.Web.Services.Protocols.SoapHttpClientProtocol > > Also, in the referece list of current winform project, right click the > "system.web.services" and select properties, is its version "v2.0.50727"? > And its path is > "\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.Services.dll" > > Luke Zhang > Microsoft Online Community Support > > ================================================== > When responding to posts, please "Reply to Group" via your newsreader so > that others may learn and benefit from your issue. > ================================================== > > (This posting is provided "AS IS", with no warranties, and confers no > rights.) > > Thanks. I may need to review your actual code to narrow down the problem.
Can you send me the web service project, if it wasn't too large. To get my actual email, please remove the string "online". Regards, Luke Zhang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) Hello Jason,
I sorry to say that I still didn't find the attachments files you sent to my hotmail box. Anyway, I sent you a sample which on my side don't have the problem. You may set up it on your server to see if it can work . Also, if you keep the web service and create a new winform project, add the web reference, compile it, can you reproduce the problem? Regards, Luke Luke Zhang Microsoft Online Community Support ================================================== When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue. ================================================== (This posting is provided "AS IS", with no warranties, and confers no rights.) |
|||||||||||||||||||||||