By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,182 Members | 1,560 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,182 IT Pros & Developers. It's quick & easy.

unexplained partial classes compiler error between 2005 and 2008

P: n/a
Hi,

im moving a project from vs2005 to vs 2008.

is doing so i have come across a compiler error regarding partial
classes that i dont understand if anyone can explain it to me please

the orig defintion that compiles and runs fine in vs2005 is
bellow......

However in porting this to vs2008 the compiler throws up errors
indicating the need for a missing partial keyword reference in
FrameMessage.cs. Do this clears that error but then throws up heaps of
warnings about duplicate declerations in both classes.

I dont understand why this compiles cleanly in 2005 and throws up
errors in 2008. I would have expected the 2005 compiler to also
produce errors becasue at first glance it seems the 2008 way is
correct

I dont know why the orig coder has the duplication in definition or
how this even worked ok in 2005

It realy bugging me if anyone can explain this to me or point in the
direction of whats hapening it would be appreciated

thanks

Peted


FrameMessage.cs
namespace BillingCommon {
using System;
using System.Data;
using System.Xml;
using System.Runtime.Serialization;

[Serializable()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Diagnostics.DebuggerStepThrough()]
[System.ComponentModel.ToolboxItem(true)]
public class FrameMessage : DataSet {

private MessageDataTable tableMessage;

public FrameMessage() {
this.InitClass();

FrameMessage.Designer.cs
#pragma warning disable 1591

namespace BillingCommon.Globals {
using System;

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Data.Design.TypedDataSetGenerator",
"2.0.0.0")]
[Serializable()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.ComponentModel.ToolboxItem(true)]

[System.Xml.Serialization.XmlSchemaProviderAttribut e("GetTypedDataSetSchema")]
[System.Xml.Serialization.XmlRootAttribute("FrameMe ssage")]

[System.ComponentModel.Design.HelpKeywordAttribute( "vs.data.DataSet")]
public partial class FrameMessage : System.Data.DataSet {

private MessageDataTable tableMessage;

Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Pete,

The two FrameMessage classes are two different classes, not partial ones.
You have defined

partial class BillingCommon.FrameMessage

and

partial class BillingCommon.Global.FrameMessage

This will indeed compile successfully in VS2005.

I suspect in VS2008 there is a check for another partial class matching the
defined ones. Or maybe the conversion strips the partial keyword since it
can't mind a matching partial class. If the intention was that these two
classes should be partial to eachother, then they would not compile in VS2005
either, due to duplicate declarations.

--
Happy Coding!
Morten Wennevik [C# MVP]
"Peted" wrote:
Hi,

im moving a project from vs2005 to vs 2008.

is doing so i have come across a compiler error regarding partial
classes that i dont understand if anyone can explain it to me please

the orig defintion that compiles and runs fine in vs2005 is
bellow......

However in porting this to vs2008 the compiler throws up errors
indicating the need for a missing partial keyword reference in
FrameMessage.cs. Do this clears that error but then throws up heaps of
warnings about duplicate declerations in both classes.

I dont understand why this compiles cleanly in 2005 and throws up
errors in 2008. I would have expected the 2005 compiler to also
produce errors becasue at first glance it seems the 2008 way is
correct

I dont know why the orig coder has the duplication in definition or
how this even worked ok in 2005

It realy bugging me if anyone can explain this to me or point in the
direction of whats hapening it would be appreciated

thanks

Peted


FrameMessage.cs
namespace BillingCommon {
using System;
using System.Data;
using System.Xml;
using System.Runtime.Serialization;

[Serializable()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.Diagnostics.DebuggerStepThrough()]
[System.ComponentModel.ToolboxItem(true)]
public class FrameMessage : DataSet {

private MessageDataTable tableMessage;

public FrameMessage() {
this.InitClass();

FrameMessage.Designer.cs
#pragma warning disable 1591

namespace BillingCommon.Globals {
using System;

[System.CodeDom.Compiler.GeneratedCodeAttribute("Sy stem.Data.Design.TypedDataSetGenerator",
"2.0.0.0")]
[Serializable()]
[System.ComponentModel.DesignerCategoryAttribute("c ode")]
[System.ComponentModel.ToolboxItem(true)]

[System.Xml.Serialization.XmlSchemaProviderAttribut e("GetTypedDataSetSchema")]
[System.Xml.Serialization.XmlRootAttribute("FrameMe ssage")]

[System.ComponentModel.Design.HelpKeywordAttribute( "vs.data.DataSet")]
public partial class FrameMessage : System.Data.DataSet {

private MessageDataTable tableMessage;

Jun 27 '08 #2

P: n/a


thanks for that, i think you saved me a lot of time, looking at the
vs2008 conversion it had renamed both to same namespace for some
reason i cant imagine.

thanks for that

Peted
>
The two FrameMessage classes are two different classes, not partial ones.
You have defined

partial class BillingCommon.FrameMessage

and

partial class BillingCommon.Global.FrameMessage

This will indeed compile successfully in VS2005.

I suspect in VS2008 there is a check for another partial class matching the
defined ones. Or maybe the conversion strips the partial keyword since it
can't mind a matching partial class. If the intention was that these two
classes should be partial to eachother, then they would not compile in VS2005
either, due to duplicate declarations.
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.