Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / November 2006

Tip: Looking for answers? Try searching our database.

Application.ProductVersion gives NullReferenceException

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SvdSinner - 10 Nov 2006 14:38 GMT
I am working on upgrade a C# winform application from the 1.1 framework to
the 2.0 framework and experiencing a bizarre error.

When my converted aplication queries Application.ProductVersion, it throws a
System.NullReferenceException.  This never happened in 1.1 and I don't think
it is supposed to work this way in 2.0.

The only solution my Google-Foo has found it make certain the main method is
named Main() not main().  This was not the problem.  

How can I get the expected behavior out of Application.ProductVersion?

FWIW, my AssemblyInfo.CS contains:
[assembly : AssemblyVersion("2.2.0.0")]
which works just as expected in 1.1
Ciaran O''Donnell - 10 Nov 2006 14:51 GMT
This is very strange as the System.Windows.Forms.Application.ProductVersion
doesnt throw exceptions and is well coded to prevent them. Post you code
incase it is something about how you are calling or using it.

Ciaran O'Donnell

> I am working on upgrade a C# winform application from the 1.1 framework to
> the 2.0 framework and experiencing a bizarre error.
[quoted text clipped - 11 lines]
> [assembly : AssemblyVersion("2.2.0.0")]
> which works just as expected in 1.1
SvdSinner - 11 Nov 2006 13:05 GMT
There isn't anything interesting about the code.  It is a simple string
myVariable = "Blahblah " + Application.ProductVersion;

I tried to comment it out, and then a few lines later got a bizarre
exception about drag/drop on a line that set the Visible property of the form
to true.

Could it be possible that my 2.0 framework is corrupt somehow?  Is there a
way the framework can be effectively removed and reinstalled?

> This is very strange as the System.Windows.Forms.Application.ProductVersion
> doesnt throw exceptions and is well coded to prevent them. Post you code
[quoted text clipped - 17 lines]
> > [assembly : AssemblyVersion("2.2.0.0")]
> > which works just as expected in 1.1
Ciaran O''Donnell - 13 Nov 2006 13:00 GMT
You should be able to uninstall it in 'Add/Remove Programs' and then download
a new installer for it.
Sounds like a good be, even if just to remove the option from a list of
possibles

Ciaran O'Donnell

> There isn't anything interesting about the code.  It is a simple string
> myVariable = "Blahblah " + Application.ProductVersion;
[quoted text clipped - 27 lines]
> > > [assembly : AssemblyVersion("2.2.0.0")]
> > > which works just as expected in 1.1

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.