Freigeben über


ASP.net 2.0 Upgrade Issues

Question:
"I’ve upgraded a web application which is currently using .NET 1.1 Framework to .NET 2.0 Framework for development purpose. Here are the issues I faced.
1.
Variable ' variablename' is used before it has been assigned a value. A null reference exception could result at runtime
2. Function ' functionname' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used
3. Unused local variable ' variablename' "

Solution:
1. You have to initialize the variable first. Eg: Dim i as integer = 0 ' please give value to it.

2. You have to define the type of the function.

    Public Sub GetIt() ' don't return value

    Public FUnction GetIT() as Integer ' return value

3. This message appears because you didn't use the variable you have declraed. You got examine your code, perhaps the variables you intend to use didn’t hit.

Here is an article talks on the Common Web Project Conversion Issues and Solutions you might find useful.