473,320 Members | 1,939 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.

How to Obsolete two related classes?

If I have a reusbale (GAC-'registered') assembly that contains two,
[cross-]related classes (imagine a DataSet and DataTable; the former
contains instances of the latter, the latter has a reference to its
parent .. er .. former).

I want to make /both/ of these classes Obsolete, so I added Obsolete
attributes to both. When these are only Warnings ...

<Obsolete("DO NOT USE", False)>

.... all is well; I can compile my assembly and get Warnings if I try to
compile other code against them.

My problem, though, is that I want to make these Errors, so that people
really /really/ can't compile against them. So, I up-ed the Obsolete
attribute to be an error ...

<Obsolete("NO, REALLY - DO NOT USE", True)>

.... but now I can't compile *my* assembly, because the Obsolete classes
refer to one another!

Is there any way of doing this?
An "IgnoreObsoleteAttributeOn(System.Type)" attribute, perhaps?

TIA,
Phill W.
oone is parent
Apr 28 '06 #1
4 1433
Phill,
I've been pondering an answer for a few days now...

The "Best" I can come up with is to decouple the relationship between the
classes. Either completely severe the relationship & let the versioning of
the GAC take care of current code. Or replace the relationship with an
interface that only has an Obsolete(false) attribute on it or an internal
interface, which would probably break existing code. Alternatively put
Obsolete(True) on each member of both types, except for the referring
members themselves.

Remember assemblies in the GAC can be (should be) versioned. I would expect
"Deleting" these two types to be the moral equivalent to a new version,
hence I would introduce a new version in the GAC, as opposed to simply
replacing an existing version.

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-k> wrote in message
news:e2*********@yarrow.open.ac.uk...
| If I have a reusbale (GAC-'registered') assembly that contains two,
| [cross-]related classes (imagine a DataSet and DataTable; the former
| contains instances of the latter, the latter has a reference to its
| parent .. er .. former).
|
| I want to make /both/ of these classes Obsolete, so I added Obsolete
| attributes to both. When these are only Warnings ...
|
| <Obsolete("DO NOT USE", False)>
|
| ... all is well; I can compile my assembly and get Warnings if I try to
| compile other code against them.
|
| My problem, though, is that I want to make these Errors, so that people
| really /really/ can't compile against them. So, I up-ed the Obsolete
| attribute to be an error ...
|
| <Obsolete("NO, REALLY - DO NOT USE", True)>
|
| ... but now I can't compile *my* assembly, because the Obsolete classes
| refer to one another!
|
| Is there any way of doing this?
| An "IgnoreObsoleteAttributeOn(System.Type)" attribute, perhaps?
|
| TIA,
| Phill W.
|
|
| oone is parent
May 3 '06 #2
Jay B. Harlow [MVP - Outlook] wrote:
Phill,
I've been pondering an answer for a few days now...

Remember assemblies in the GAC can be (should be) versioned. I would expect
"Deleting" these two types to be the moral equivalent to a new version,
hence I would introduce a new version in the GAC, as opposed to simply
replacing an existing version.

Jay,

Thanks for taking the trouble over this one.
One question about assembly versioning, if I may?

When deploying to my host servers, both application and shared assembly
files are first physically copied onto the machine's disk (from a
"Master Image" held and updated centrally), then each shared Dll is
GacUtil'ed into the Global Assembly Cache.

I've released v1.0[.0.0] of a shared Dll called, say, X.dll - well, I'm
/never/ go to have more than /26/ of these things, am I? ;-)
I have applications using this Dll.
If I release v1.1[.0.0] of a shared Dll next year, my machines will get
[shadow] copies of /both/ versions of X.dll, but taken from the same
physical source file.

But what happens to machines that are built in-between the two releases?

My "Master Image" contains /only/ the latest version (v1.1) of my shared
X.dll and only this version will be added to the Global Assembly Cache
because my deployment mechanism "registers" whatever happens to be in
the physical file. "Older" applications, expecting to use v1.0 will
therefore break, because that version "doesn't exist" (in the GAC) on
the newly built machine.

Do I really have to resort to "numbering" my physical Dll's as well, as
in ...
X.1.0.dll
X.1.1.dll
X.1.2.dll
.... in order to preserve my applications' stability over the Long Term?

TIA,
Phill W.
May 5 '06 #3
Phill,
Not sure if you are still following this thread.

Another possibly is to use ildasm.exe to disassembly the assembly into IL,
modify the attribute in the IL, then use ilasm.exe to re-assemble the
assembly

I was looking at the new compiler warnings option in 2005, however I don't
see a way in either the UI or the project file itself to have VB treat error
30668 (the error that Obsolete(True) appears to be) as a warning or to
simply ignore it...

--
Hope this helps
Jay B. Harlow [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"Phill W." <p-.-a-.-w-a-r-d@o-p-e-n-.-a-c-.-u-k> wrote in message
news:e2*********@yarrow.open.ac.uk...
| If I have a reusbale (GAC-'registered') assembly that contains two,
| [cross-]related classes (imagine a DataSet and DataTable; the former
| contains instances of the latter, the latter has a reference to its
| parent .. er .. former).
|
| I want to make /both/ of these classes Obsolete, so I added Obsolete
| attributes to both. When these are only Warnings ...
|
| <Obsolete("DO NOT USE", False)>
|
| ... all is well; I can compile my assembly and get Warnings if I try to
| compile other code against them.
|
| My problem, though, is that I want to make these Errors, so that people
| really /really/ can't compile against them. So, I up-ed the Obsolete
| attribute to be an error ...
|
| <Obsolete("NO, REALLY - DO NOT USE", True)>
|
| ... but now I can't compile *my* assembly, because the Obsolete classes
| refer to one another!
|
| Is there any way of doing this?
| An "IgnoreObsoleteAttributeOn(System.Type)" attribute, perhaps?
|
| TIA,
| Phill W.
|
|
| oone is parent
May 5 '06 #4
Jay B. Harlow [MVP - Outlook] wrote:
Phill,
Not sure if you are still following this thread.
Oh; I'm still here ...
not all there perhaps, but still here ... ;-)
Another possibly is to use ildasm.exe to disassembly the assembly into IL,
modify the attribute in the IL, then use ilasm.exe to re-assemble the
assembly
Now that's something I'd not thought about.
Now; could it really be as simple as ILDASM the assembly, Cut-and-Paste,
ILASM it back together again and Bingo! ??

I'll have a play ...
I was looking at the new compiler warnings option in 2005, however I don't
see a way in either the UI or the project file itself to have VB treat error
30668 (the error that Obsolete(True) appears to be) as a warning or to
simply ignore it...


Nothing like Progress, eh? :-)

Regards,
Phill W.
May 8 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: jbeerni | last post by:
In .NET, you can mark methods and accessors as obsolete by using the directive. I've found some interesting behavior with the directive when used in a class which is referenced as a return type...
4
by: BrianProgrammer | last post by:
I have this code below, that works like a champ, but two lines are continually marked as obsolete. See embeded notes. Private Shared Function TransformHTMLString(ByVal XSLT As String, _ ByVal...
2
by: Womble One | last post by:
Is there any way to get the 'Obsolete' attribute to work across multiple solutions? I currently have 70 solutions, each with 3 projects in them, and would like to change some base architecture,...
2
by: Steve James | last post by:
I am trying to mark an override method in a derived class as obsolete using the ObsoleteAttribute. The compiler, however is not picking up this attribute and is not generating a warning or an...
1
by: BrianProgrammer | last post by:
I have this code below, that works like a champ, but two lines are continually marked as obsolete. See embeded notes. Private Shared Function TransformHTMLString(ByVal XSLT As String, _ ByVal...
17
by: Benny Raymond | last post by:
I have a thread that sleeps for 5 minutes once it's finished running a method and then it repeats itself if it's supposed to (bool = true). Prior to 2.0 I was able to resume the thread after...
9
by: Erwin Moller | last post by:
Hi, Can anybody comment on this? In comp.lang.php I advised somebody to skip using: <script language="javascript"> and use: <script type="text/javascript"> And mr. Dunlop gave this response:
16
by: cj | last post by:
I am under the impression they are obsolete methods included for backward compatibility. For instance is using filedatetime("c:\myfile.txt") still the accepted way of getting the date...
11
by: raylopez99 | last post by:
I just downloaded the apparently free SDK for DirectX 9, all 200+ MB of it, but as I read about WPF I wonder: is DirectX obsolete? Should I even bother learning how to use it? After all, the end...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.