Code broke Windows application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Well I had code break on a compiled version of a Visual Basic .net application that was in use. Here is the story.

Environment: Windows network using Windows 2000 advanced Servers and Windows 2000 workstation Service Pack 4. .net Applications written with .net framework 1.

The other day we had a series of security upgrades deployed on our network. As soon as that happened a Visual Basic .net application in use for some time developed numerous problems and was generating error messages all over the place. On workstations that had earlier versions of the .net framework, those versions had been removed and only the latest version which had been installed during the security upgrades remained.

I looked at the source code of two applications written in vb.net and found the following problem. All Catch statements that worked previously had an error in the source code when I examined it. The basic Catch statement Catch ex as exception no longer was valid. the squiggly blue line appeared under the ex. To rectify the problem I was required to type

Catch ex as System.exceptio

Obviously the reference for System had always been present in the application. Just as an experiment I added Imports System to some of the class modules, but I was still required to type system.exception where ever a Catch statement was used in the apps that existed prior to the network upgrades. If I create a new project however, catch ex as exception statement doesn't have an error and the code compiles with no need to use the expanded system.exception. But in the .net apps that were written before the upgrade that code errors 100% of the time on catch statements and I must now type system.exception in all my catch statements

I have tried deleting the references and re-entering them and all sorts of other tricks. I am pretty sure that those older apps are looking for a different version of the framework that is no longer there

I could just leave all the syntax changed to Catch ex as system.exception but I am worried about the implications of what has happened to cause this code to break, and would sure like to know how to fix the problem without having to change code that shouldn't be broken.

Any thoughts or suggestions would be greatly appreciated.
 
Larry,
This may sound cruel, but I suspect if you had Option Explicit and Option
Strict both set to "on" when you wrote the app, the problem would never have
appeared. Why MS decided VB.NET programmers to have them set to "off" by
default, I'll never know...
--Peter

Larry said:
Well I had code break on a compiled version of a Visual Basic .net
application that was in use. Here is the story.
Environment: Windows network using Windows 2000 advanced Servers and
Windows 2000 workstation Service Pack 4. .net Applications written with
..net framework 1.1
The other day we had a series of security upgrades deployed on our
network. As soon as that happened a Visual Basic .net application in use
for some time developed numerous problems and was generating error messages
all over the place. On workstations that had earlier versions of the .net
framework, those versions had been removed and only the latest version which
had been installed during the security upgrades remained.
I looked at the source code of two applications written in vb.net and
found the following problem. All Catch statements that worked previously had
an error in the source code when I examined it. The basic Catch statement
Catch ex as exception no longer was valid. the squiggly blue line appeared
under the ex. To rectify the problem I was required to type:
Catch ex as System.exception

Obviously the reference for System had always been present in the
application. Just as an experiment I added Imports System to some of the
class modules, but I was still required to type system.exception where ever
a Catch statement was used in the apps that existed prior to the network
upgrades. If I create a new project however, catch ex as exception
statement doesn't have an error and the code compiles with no need to use
the expanded system.exception. But in the .net apps that were written
before the upgrade that code errors 100% of the time on catch statements and
I must now type system.exception in all my catch statements.
I have tried deleting the references and re-entering them and all sorts of
other tricks. I am pretty sure that those older apps are looking for a
different version of the framework that is no longer there.
I could just leave all the syntax changed to Catch ex as system.exception
but I am worried about the implications of what has happened to cause this
code to break, and would sure like to know how to fix the problem without
having to change code that shouldn't be broken.
 
Back
Top