.NET Questions and Solutions

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘value’

FIX: A NullReferenceException error occurs when you use a method that has the default null value as a parameter in the .NET Framework 1.1

Symptoms
A NullReferenceException error may occur in the Microsoft .NET Framework version 1.1 when one of the following conditions is true: You use reflection to obtain a default value of a parameter out of a method that uses a default null value for a parameter.You use reflection to invoke a method that uses a default null value for a parameter.
Resolution
To resolve this problem, obtain the latest service pack for the Microsoft .NET Framework 1.1. For more information, visit the following Microsoft Web site:
http://www.microsoft.com/downloads/details.aspx?FamilyId=A8F5654F-088E-40B2-BBDB-A83353618B38(http://www.microsoft.com/downloads/details.aspx?FamilyId=A8F5654F-088E-40B2-BBDB-A83353618B38)

BUG: You receive an error message when you serialize a DBConcurrencyException object in ADO.NET 1.0

Symptoms
When you serialize a DBConcurrencyException object, the value of the Row property in the serialized version of the object is set to a null value and an exception occurs:

An unhandled exception of type ‘System.NullReferenceException’ occurred in app_name.exe
Additional information: Object reference not set to an instance of an object.
Resolution
Serialization support is not provided for DataRows in this version of Microsoft Visual Studio .NET.

BUG: You receive a “Type mismatch” error message when you assign a value type variable to a property through COM InterOp in Visual Basic .NET or in Visual Basic 2005

Symptoms
When you assign a value to a property of a Component Object Model (COM) object in .NET, you may receive the following error message when you run your application:

An unhandled exception of type ‘System.Runtime.InteropServices.COMException’ occurred in InterOpDemo.exe
Additional information: Type mismatch
Resolution
The problem occurs if all of the following conditions are true: You are using the COM object in early bound mode.The property in the COM object has both Set and Let methods.You are trying to pass a value type variable to that property. In early bound mode, Microsoft Visual Basic .NET and Visual Basic 2005 always call the Set method of the property if it is available. If you want to call the Let method, you must explicitly specify it.

An exception may not show up in the Windows Firewall graphical user interface if you create the exception by modifying the registry

Symptoms
If you create an exception by modifying the registry on a computer that is running Microsoft Windows XP Service Pack 2 (SP2) or Microsoft Windows Server 2003 Service Pack 1 (SP1), the exception may not show up in the Windows Firewall graphical user interface.
Resolution
This behavioroccurs if you do not specify a name when you add an exception by modifying the registry key. For example,this behavior occurs if you add a port to the registry andthen set the registry value to 12345:TCP:*:Enabled. This value opens the TCP port 12345.However, the Windows Firewall graphical user interface does not show this port because the registry value does not contain a name. The following value is the correct value:
12345:TCP:*:Enabled:exception name