471,624 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

unexplained partial classes compiler error between 2005 and 2008

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
2 1983
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


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.

Similar topics

9 posts views Thread by Gomaw Beoyr | last post: by
16 posts views Thread by Madhuri Mittal | last post: by
1 post views Thread by Bishoy George | last post: by
9 posts views Thread by Fat Elvis | last post: by
2 posts views Thread by Sebastian | last post: by
5 posts views Thread by Sagar | last post: by
35 posts views Thread by =?Utf-8?B?UElFQkFMRA==?= | last post: by
1 post views Thread by XIAOLAOHU | last post: by

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.