473,760 Members | 8,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Componen tModel.Designer CategoryAttribu te("code")]
[System.Diagnost ics.DebuggerSte pThrough()]
[System.Componen tModel.ToolboxI tem(true)]
public class FrameMessage : DataSet {

private MessageDataTabl e tableMessage;

public FrameMessage() {
this.InitClass( );

FrameMessage.De signer.cs
#pragma warning disable 1591

namespace BillingCommon.G lobals {
using System;

[System.CodeDom. Compiler.Genera tedCodeAttribut e("System.Data. Design.TypedDat aSetGenerator",
"2.0.0.0")]
[Serializable()]
[System.Componen tModel.Designer CategoryAttribu te("code")]
[System.Componen tModel.ToolboxI tem(true)]

[System.Xml.Seri alization.XmlSc hemaProviderAtt ribute("GetType dDataSetSchema" )]
[System.Xml.Seri alization.XmlRo otAttribute("Fr ameMessage")]

[System.Componen tModel.Design.H elpKeywordAttri bute("vs.data.D ataSet")]
public partial class FrameMessage : System.Data.Dat aSet {

private MessageDataTabl e tableMessage;

Jun 27 '08 #1
2 2127
Hi Pete,

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

partial class BillingCommon.F rameMessage

and

partial class BillingCommon.G lobal.FrameMess age

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.Componen tModel.Designer CategoryAttribu te("code")]
[System.Diagnost ics.DebuggerSte pThrough()]
[System.Componen tModel.ToolboxI tem(true)]
public class FrameMessage : DataSet {

private MessageDataTabl e tableMessage;

public FrameMessage() {
this.InitClass( );

FrameMessage.De signer.cs
#pragma warning disable 1591

namespace BillingCommon.G lobals {
using System;

[System.CodeDom. Compiler.Genera tedCodeAttribut e("System.Data. Design.TypedDat aSetGenerator",
"2.0.0.0")]
[Serializable()]
[System.Componen tModel.Designer CategoryAttribu te("code")]
[System.Componen tModel.ToolboxI tem(true)]

[System.Xml.Seri alization.XmlSc hemaProviderAtt ribute("GetType dDataSetSchema" )]
[System.Xml.Seri alization.XmlRo otAttribute("Fr ameMessage")]

[System.Componen tModel.Design.H elpKeywordAttri bute("vs.data.D ataSet")]
public partial class FrameMessage : System.Data.Dat aSet {

private MessageDataTabl e 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.F rameMessage

and

partial class BillingCommon.G lobal.FrameMess age

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
2529
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. I.e. do we have to need to write:
16
423
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 know VB.Net does not allow it, however was wondering if it's possible using C#? Madhuri Mittal
10
2445
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 load as a 3rd partial class. This would be handy so i can generate standard code into one of the partial classes, while having my custom code untouched
1
2635
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 receieved this error Error 1 Missing partial modifier on declaration of type 'NagyResearch.Q_A.Q.QuestionnairePage'; another partial declaration of this type exists D:\Web Sites\Local
9
5788
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, EventArgs e) { Data_List(); } }
0
3270
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 reference?) I have a reference to AJAX.NET Pro and I created and the wire up was placed in the Webconfig file. <!-- Wire up Ajax.NET Pro ashx Handler --> <location path="ajaxpro">
2
1429
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 code-behind classes into multiple files using partial classes? It would be helpfull to balance work on multiple developers working on same subject. I've already got it done in DLL-Projects (SQL-Helper, Builders, .... ) but how to do it in web-projects?
5
1372
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 Conversion wizard created partial classes off the existing classes. Is partial classes mandatory in VS.Net 2005 or can I still work without having to live with partial classes ?
35
2909
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 runtime and throwing an exception if the provided type is not an enum. That works, but it just doesn't seem quite right. After reading through section 4.4.4 of the C# 3.0 spec I see no reason why constraining to System.Enum should not be allowed.
0
10107
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9945
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8768
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7324
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5361
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3863
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.