473,320 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 2084
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Gomaw Beoyr | last post by:
Two question about the "partial classes" (in the next wersion of ..NET). Question 1 ========== Will partial classes (in the next version of C#) have to be declared "partial" in ALL places. ...
16
by: Madhuri Mittal | last post by:
Hi, I know that we can define a class over multiple source files using the keyword 'Partial' in C# within a project. Can we define the class over multiple projects using the 'Patial' keyword- I...
10
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
1
by: Bishoy George | last post by:
In a web application using asp.net 2.0 All my classes are partial classes. - I noticed that partial class cannot be inherited... is that true? - I tried to remove the partial keyword , and I...
9
by: Fat Elvis | last post by:
I'd like to extend some of my Asp.net pages by using Partial Classes. Example ASP.Net Page: public partial class Admin_Customer : System.Web.UI.Page { protected void Page_Load(object sender,...
0
by: WebDev2 | last post by:
I can't get AJAX.NET Pro to work. I keep getting a Compiler Error Message: CS0246: The type or namespace name 'AjaxPro' could not be found (are you missing a using directive or an assembly...
2
by: Sebastian | last post by:
Hi Everyone, we're currently developing an web-app for insurance company. We've got a long form-flows and view-classes (MVC) of about 2000 lines of code. Is there any possibility to split...
5
by: Sagar | last post by:
I am working on a migration project for a huge asp.net application now running in framwework 1.1 to dotnet 2.0 As a first step, I opened the .sln files of the project in VS.Net 2005. The...
35
by: =?Utf-8?B?UElFQkFMRA==?= | last post by:
I'd really like to be able to constrain a generic type to System.Enum or, better, enum. But of course that results in "Compiler Error CS0702". So far I've been checking the type parameter at...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.