unexplained partial classes compiler error between 2005 and 2008

P

Peted

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("code")]
[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("System.Data.Design.TypedDataSetGenerator",
"2.0.0.0")]
[Serializable()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.ComponentModel.ToolboxItem(true)]

[System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema")]
[System.Xml.Serialization.XmlRootAttribute("FrameMessage")]

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

private MessageDataTable tableMessage;
 
M

Morten Wennevik [C# MVP]

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.
 
P

Peted

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top