Welcome to CrankyGoblin.Com Sign in | Join | Help

Public Class GeoffAppleby

Inherits Microsoft.VisualBasic.MVP : Implements IBrainFart
Dealing with Obsolete Code

Last week I did my first serious work with VS2005. Sure, I've played a lot with it, and compiled and run and tested a hell of a lot of different snippets and played with a lot of new features, but on Friday I started working on converting all our base libraries to the 2.0 framework.

Not surprisingly, there was very little that was problematic, and what problems were there were easily diagnosed with help from the built in FxCop engine.

The first main problem was that a couple of classes had a method called Continue, which is now a keyword in VB2005. Easily fixed by wrapping a pair of square brackets around it to escape it: [Continue].

The second to look at was a whole heap of warnings that a variable might be used uninitialised. In all cases it reported this problem, it wasn't actually a problem - they were all tests for Nothing. A while back we decided that initializing reference types to Nothing explicitly was really a waste of time, since the framework guarantees this anyway. As soon as an explicit set to Nothing was added, the warning went away. I'm still undecided what to do here - I like having no warnings, and I don't want to disable this one, but having to add extra code just to satisfy FxCop is annoying (although it's really no big deal).

Then there was the reports of things were now obsoleted. This is an interesting one. The people that control the framework API's have decided that there's some calls that were available in the 1.0/1.1 framework that really shouldn't be called anymore. Instead of taking it away and causing a breaking change, they've marked them obsolete with an ObsoleteAttribute.

The most common one that showed up was easy - any call I had to System.Configuration.ConfigurationSettings just needed to be changed to System.Configuration.ConfigurationManager. Easy enough, one I worked out I needed to add a reference to the new System.Configuration.dll :)

The next one more problematic. To handle SSL certificates silently, you used to be able pass an instance of some class that implements ICertificatePolicy to the CertificatePolicy property of the ServicePointManager. Now it all different - now you pass the ServerCertificateValidationCallback property a delegate of type RemoteCertificateValidationCallback. So that's a whole class I have to re-write. No biggie, and certainly not hard :)

The last one is one that's going to take some thought. Thread.Suspend and Thread.Resume have been obsoleted.

I can understand perfectly why this has been done - and in the words of the guys that wrote the threading stuff in the first place, they never should have made it available to begin with. If some random thread comes along and suspends another one, what was that thread doing at the time it got suspended? It might be in the middle of  a DB call. It might have a whole lot of different resources locked. Too many bad things could happen.

Once I thought about it, it made perfect sense. And now I need to completely rewrite how a couple of my classes work :) The advice offered has only been that some other way must be used, but not many specifics on how. The way I see it, I need to make the threads that need to be paused constantly checking to see if they have been signalled, and block themselves until the signal has been reset.

It's no big deal, but a slight perf hit.

And admittedly, the only reason I wrote a 'pause' functionality into these classes is that they're in use from a windows service, and windows services can be paused.

But all in all, I think I got off lightly. There's a fair few other things within the framework that have been obsoleted too, and we don't touch any of them. Brad Abrams gave some warning of what was coming here.

Posted: Sunday, October 23, 2005 4:51 PM by Geoff Appleby

Comments

Miki Watts said:

>> The second to look at was a whole heap of warnings that a variable might be used uninitialised. In all cases it reported this problem, it wasn't actually a problem - they were all tests for Nothing. A while back we decided that initializing reference types to Nothing explicitly was really a waste of time, since the framework guarantees this anyway. As soon as an explicit set to Nothing was added, the warning went away. I'm still undecided what to do here - I like having no warnings, and I don't want to disable this one, but having to add extra code just to satisfy FxCop is annoying (although it's really no big deal).

If the variable is uninitialized, and by the time you check if it's Nothing, it hasn't been touched, why even check for Nothing?
# October 23, 2005 8:53 PM

Geoff Appleby said:

It was mostly to do within some caching code and lazy loading. Here's a (very) dummy example:

Public Function GetItem() as Something

dim oRet as SomeThing

If (I can find the thing in the cache) Then
oRet = GetTheThingFromTheCache()
End If

If oRet Is Nothing Then
'lazy load the object and add it to the cache
End If

Return oRet

End Function

You see, oRet _might_ have been filled already, but that assignment is wrapped in a conditional.
# October 23, 2005 9:27 PM

LeVaN said:

http://www.alexa-***.seksi-***.com ^^^ http://www.alexa-***-on-her-face.seksi-***.com ^^^ http://www.sharday-big-boobs.str0nz0.com ^^^ http://www.storie-di-fate.str0nz0.com ^^^ http://www.perras-calatas-film.100milfotos.com ^^^ http://www.download-macho-pollon.100milfotos.com ^^^ http://www.bei-culetti-femminili-masturbating.allievo69.com ^^^ http://www.asunithiston-dagkomatia.allievo69.com ^^^ http://www.toverillinen-aasialainen-koura.huor4.com ^^^ http://www.kohtuuttomasti-opiskelija-***.huor4.com ^^^ http://www.taivaallinen-koulutytto-tupla-penetraatio.hu0ra.com ^^^ http://www.lammin-nuori.hu0ra.com ^^^ http://www.imbarazzato-operaio-fotti.fott1.com ^^^ http://www.likeable-lesbiche-azione.fott1.com ^^^ http://www.fun-segretaria-***.f0tti.com ^^^ http://www.fair-moglie-diteggiatura.f0tti.com ^^^ http://www.lvi-kauppa-lesbisk.s3ksi.com ^^^ http://www.outo-leike.s3ksi.com ^^^ http://www.sesso-violadas-brutales-fotos.ragazza69.com ^^^ http://www.lesbica-lez-cuties.ragazza69.com ^^^ http://www.moro-ariston.corneo69.com ^^^ http://www.video-fumatrici-lesbica.corneo69.com ^^^ http://www.video-adolesentes-follando.dibujitosporn.com ^^^ http://www.minorenni-inculate-jpg.dibujitosporn.com ^^^ http://www.fotolog-golosas-penis.disponibile69.com ^^^ http://www.donne-mature-scopando-sesso.disponibile69.com ^^^ http://www.negras-ricas-download.gayfrei.com ^^^ http://www.galeria-posizioni-sexy.gayfrei.com ^^^ http://www.mega-tetas.petarda2fotos.com ^^^ http://www.www-erotismo-com.petarda2fotos.com ^^^ http://www.negras-x.lesbianavideo.com ^^^ http://www.foto-xxx-vagina.lesbianavideo.com ^^^ http://www.jovenes-ricas-mpg.pollonesamateur.com ^^^ http://www.mpeg-maricones-calientes.pollonesamateur.com ^^^ http://www.defecando-xxx.sexoexnovia.com ^^^ http://www.gif-amateur-blog.sexoexnovia.com ^^^ http://www.hombres-bellos.latinas-putas.com ^^^ http://www.video-de-tsunamis.latinas-putas.com ^^^ http://www.fotodelahora-com-lesbianas.putasmorochas.com ^^^ http://www.lesbiana-latina.putasmorochas.com ^^^

# November 28, 2006 1:02 AM

miki said:

http://www.ghkr4icqw.info/ftnfaru.html **#**

http://piacente-segretaria-fottilo.ghkr4icqw.info/ **#**

http://acuto-napoli.gw3x6095.info/ **#**

http://prodigiosamente-amatoriali-orale-fotti.gw3x6095.info/ **#**

http://afabile-ragazze-spogliarello.h6yzmdsm.info/ **#**

http://prestito-trieste.j95c8-r-1.info/ **#**

http://www.g4sgtrt7hatu.info/autocoscienza-fighette-fottilo.html **#**

http://conigliette-in-calore.e71fjt8dy.info/ **#**

http://www.keuo0.info/kw3kyod231k.html **#**

http://villa-lusso-vacanza.e71fjt8dy.info/ **#**

http://duplicazione-video.g4sgtrt7hatu.info/ **#**

http://www.jkpaip.info/aereo-viaggi.html **#**

http://vedutismo-sardegna.cde467zt.info/ **#**

http://www.ghkr4icqw.info/3m7pwatgg.html **#**

http://www.dgrgajmcwsu.info/u4lyhcw.html **#**

http://www.i5rio48ku.info/9le9h57nvyo.html **#**

http://www.cde467zt.info/pxm762ovr/ **#**

http://strappare-fighetta-strip.mdp4vw4oxcdk.info/ **#**

http://assurdo-ragazze-azione.jpeq50t4gzp.info/ **#**

http://www.hlc4w7c48p.info/hotel-nicea-nizza/ **#**

http://stravagante-infermiera-***.j95c8-r-1.info/ **#**

http://www.dgrgajmcwsu.info/vendita-macchina-caffe/ **#**

http://www.dgrgajmcwsu.info/y7fxpzjynjd.html **#**

http://albergo-mestruo-venezia.gzdfwhf.info/ **#**

http://case-mare-affitto.g4sgtrt7hatu.info/ **#**

http://dominatrice-con-frusta.jzx87ez9h0.info/ **#**

http://www.i5rio48ku.info/libri-letteratura/ **#**

http://www.dgrgajmcwsu.info/2a4p3v5xki.html **#**

http://finanziamento-chirografario.d0tsozq.info/ **#**

http://www.dgrgajmcwsu.info/3m48vstv.html **#**

http://goodly-cowgirl-prostituta.jzx87ez9h0.info/ **#**

http://scheda-pci.jpeq50t4gzp.info/ **#**

http://fun-infermiera.gzdfwhf.info/ **#**

http://software-nokia-6600.mdp4vw4oxcdk.info/ **#**

http://ecommerce-hosting.keuo0.info/ **#**

http://comico-infermiera-anale-fotti.keuo0.info/ **#**

http://www.i5rio48ku.info/cg1zzzn.html **#**

http://www.ea2gpm6.info/ridicolo-cameriera-anale-fotti.html **#**

http://www.j95c8-r-1.info/143920776/ **#**

http://www.cde467zt.info/uudei5d.html **#**

http://porche-con-autoreggenti.bv2x0l2df5r.info/ **#**

http://carino-alto.ghkr4icqw.info/ **#**

http://www.ea2gpm6.info/cinese-sex.html **#**

http://accessorio-cellulare-it.hlc4w7c48p.info/ **#**

http://www.keuo0.info/desiderio-amatoriali-orale-fotti/ **#**

http://www.fj5sm.info/studentessa-amatoriali-orale-fotti.html **#**

http://mucca-latte.j95c8-r-1.info/ **#**

http://amiable-infermiera-doppio-penetrazione.mdp4vw4oxcdk.info/ **#**

http://www.j95c8-r-1.info/143921628/ **#**

http://piu-freddo-madre.ghkr4icqw.info/ **#**

http://www.jkpaip.info/bridge-wireless.html **#**

http://cellulare-nokia-n73.e71fjt8dy.info/ **#**

# December 29, 2006 9:32 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

To submit your comment, click on these pictures:
  • Geoff's little sister's pussy
  • Geoff's pretty blue eyes
  • Shocked Geoff
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Gaptcha Image - No Peeking! Gaptcha Image - No Peeking! Gaptcha Image - No Peeking!
Can't recognise the people in these pictures? Look here for a quick introduction.
There's a time limit for you to get your comment submitted before this set of pictures expires. If you think it's been longer than 10 minutes, get some new pictures first (you won't lose what you've typed so far).
Get some new pictures 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS