.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 ‘object reference not set to an instance’

Error message when you upgrade Microsoft Dynamics CRM 3.0 to Microsoft Dynamics CRM 4.0: “Unable to resolve related entity for report upgrade”

Symptoms
When you delete a custom entity that has a linked report in Microsoft Dynamics CRM 3.0, and then you upgrade Microsoft Dynamics CRM 3.0 to Microsoft Dynamics CRM 4.0, you receive the following error message in the CRM40Setup.log file:

Time|Error| Unable to resolve related entity for report upgrade.The entity may have been added then deleted without updating the report reference.
Report name: Activities Due, Entity logical name: activity
Time|Error| Unable to upgrade reports.System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Crm.Setup.Server.Utility.ReportUpgradeUtility.BuildRelatedEntitiesValue(String reportName, String relatedEntitiesXml, Guid organizationId)
at Microsoft.Crm.Reporting.ReportUpgradeServer.GetReportProperties(String reportName, String organizationName, Guid organizationId)
at Microsoft.Crm.Setup.Server.Utility.ReportUpgradeUtility.LoadReportProperties(ReportUpgradeServer reportUpgradeServer, Hashtable propertiesByName, String organizationName, Guid organizationId, String reportingGroup)
at Microsoft.Crm.Setup.Server.Utility.ReportUpgradeUtility.LoadReports(ReportUpgradeServer reportUpgradeServer, String organizationName, Guid organizationId, String reportingGroup)
at Microsoft.Crm.Setup.Server.Utility.ReportUpgradeUtility.UpgradeReportsFromVersion3(String organizationUniqueName, String organizationFriendlyName, String reportingGroup, Int32 languageCode, InstallInfo installInfo, IProgressEventSource progress)
at Microsoft.Crm.Setup.Server.RSUpgradeAction.Do(IDictionary parameters)
Resolution
This problem occurs because a report is linked to an entity that does not exist.

Error message when you try to save a record in Microsoft Dynamics CRM 4.0: “Object reference not set to an instance of an object”

Symptoms
When you try to save a record in Microsoft Dynamics CRM 4.0, you receive the following error message:

Object reference not set to an instance of an object.If you have enabled platform tracing, you receive an error message that resembles the following:

Application:
MSCRM Error Report:
Error: Exception has been thrown by the target of an invocation.
Error Number: 0×80040265
Error Message: Object reference not set to an instance of an object.
Error Details: Object reference not set to an instance of an object.
Platform.Sdk:
Web Service Plug-in failed in SdkMessageProcessingStepId: {F6D4EBBB-0075-407D-8208-26575BFA39AF}; EntityName: new_businessrules; Stage: 20; MessageName: Create; AssemblyName:
Microsoft.Crm.ObjectModel.MultiCurrencyPlugin, Microsoft.Crm.ObjectModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.ObjectModel.MultiCurrencyPlugin; Exception:
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Crm.ObjectModel.CalculateBaseMoney.ProcessCalculatedColumns(DynamicEntity entity, BusinessEntity entityPreImage, EntityMetadata entityMetadata, String exchangeRateFieldName, Boolean isCreateOperation, ArrayList unchangedAttributes)
Resolution
This problem occurs because a money attribute is created for the entity. When you do this, Microsoft Dynamics CRM 4.0 creates an exchangerate attribute to work together with the money attribute. The money attribute is published as part of the entity. However, if you delete the money attribute, the exchangerate attribute is not removed. Therefore, when you try to run a Microsoft Dynamics CRM plug-in, the plug-in can find the exchangerate attribute. However, the plug-in cannot find the money attribute.

Description of the PerformancePoint Server 2007 hotfix package: April 28, 2009

Symptoms
This article describes the Microsoft Office PerformancePoint Server 2007 issues that are fixed in the hotfix package that is dated April 28, 2009.
This article describes the following items about the hotfix package:The issues that the hotfix package fixes.The prerequisites for installing the hotfix package.Whether you must restart the computer after you install the hotfix package.Whether the hotfix package is replaced by any other hotfix package.Whether you must make any registry changes.The files that the hotfix package contains.
Resolution
PerformancePoint Server 2007 hotfixes are created for the release version of PerformancePoint Server 2007. All PerformancePoint Server 2007 hotfix packages are cumulative.
A hotfix package is available for PerformancePoint Server 2007. The build of this hotfix package is 3.0.4315.00. The release version of PerformancePoint Server 2007 must be installed before you apply this hotfix. The build of the release version of PerformancePoint Server 2007 is 3.0.3520.0.
Issue that the hotfix package fixesThis hotfix package fixes the following PerformancePoint Server 2007 Monitoring and Analytics issues that were not previously documented in a Microsoft Knowledge Base article.Issue 1: You cannot browse the list of Web parts when you are editing a dashboard that is deployed to a SharePoint siteIn PerformancePoint Dashboard Designer, you edit a dashboard that is deployed to a SharePoint site. When you try to browse the list of Web parts by clicking Next on the Add Web Parts panel, you receive the following error message:

Server Error in ‘/’ Application.
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Important After you apply this hotfix, you must redeploy the Dashboard Viewer for SharePoint Services Web part. To redeploy this Web part, follow these steps:Start the Monitoring Server Configuration Manager.Remove the Dashboard Viewer for SharePoint Services Web part.Re-add the Dashboard Viewer for SharePoint Services Web part.Issue 2: Time Intelligence Post Formula filters display the next day’s dateYou link a Time Intelligence Post Formula filter to a scorecard in PerformancePoint Dashboard Designer. When you preview this dashboard, you notice that the Time Intelligence Post Formula filter displays a date that isone day in advance on the scorecard. For example, the date on the client computer is March 6. When you preview this dashboard, you expect the Time Intelligence Post Formula filter to display the date asMarch 6. However, the Time Intelligence Post Formula filter displays that date as March 7. This problem occurs when a a time zone difference causes a one-day differencebetween the client computer and the server.
This problem occurs because the date on the server is not converted from Coordinated Universal Time (Greenwich Mean Time) to local time.Issue 3: Member property values may not be displayed correctly in reports or in chartsWhen a member property value is displayed in reports or in charts, you may encounter one of the following problems:The precision may be lost if the value has more than two decimal places. For example, a value of 0.001 is displayed as 0.00.The value “,00″ is added to the end of the value. For example, a value of 88.00 is displayed as 88.880,00.Issue 4: The connection to SQL Server 2008 Reporting Services fails in PerformancePoint Dashboard DesignerWhen you try to connect to a SQL Server 2008 Reporting Services report in PerformancePoint Dashboard Designer, you receive an “Unable to connect to server” error message.

Description of the .NET Framework 1.1 post-Service Pack 1 hotfix rollup package for System.windows.forms.dll

Symptoms
This article describesthe Microsoft.NET Framework 1.1 issues that are fixed in the .NET Framework 1.1 post-Service Pack 1 hotfix rollup package for System.windows.forms.dll.
Issues that are fixed in the hotfix packageFor more information, click the following article number to view the article in the Microsoft Knowledge Base:
875434?(http://support.microsoft.com/kb/875434/) FIX: You receive a NullReferenceException exception when you manually set a Control ID in the .NET Framework 1.1
840503?(http://support.microsoft.com/kb/840503/) FIX: The scroll bar may not show the correct position in a spreadsheet in a Windows Forms application in the Microsoft .NET Framework 1.1
841096?(http://support.microsoft.com/kb/841096/) Validation event does not fire for Microsoft Windows Forms controls
873429?(http://support.microsoft.com/kb/873429/) FIX: A gradual memory leak occurs in a WinForm application when you create, modify, or remove a MenuItem property for an MDI form in the .NET Framework 1.1
884579?(http://support.microsoft.com/kb/884579/) FIX: The Click event for a button in a UserControl control occurs even though another UserControl control is set to cancel form validation in a Microsoft Windows Forms application that is built on the Microsoft .NET Framework 1.1
886802?(http://support.microsoft.com/kb/886802/) FIX: You may receive the “AxImp error object reference not set to an instance of an object” error message when you run AxImp.exe on an ActiveX control in the .NET Framework 1.1
886686?(http://support.microsoft.com/kb/886686/) FIX: You can close a form by using the Close button even if the Cancel property of a Validating event is set to True on an object in a Windows Forms application in the .NET Framework 1.1
885446?(http://support.microsoft.com/kb/885446/) FIX: You may experience unexpected behavior when you press TAB or ENTER in a Windows Form on a computer that is running the .NET Framework 1.1 S885446
Resolution
Hotfix informationA supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next .NET Framework 1.1 service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support(http://support.microsoft.com/contactus/?ws=support)NoteIn special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.PrerequisitesYou must have the.NET Framework 1.1 Service Pack 1 (SP1) installed to apply this hotfix.Restart informationYou do not have to restart your computer after you apply this hotfix.Hotfix replacement informationThis hotfix is not replaced by any later hotfix.Registry informationYou do not have to create or to modify any registry keys to activate any hotfixes that are contained in this package.Hotfix file informationThis hotfix contains only those files that you must have to correct the issues that this article lists. This hotfix may not contain of all the files that you must have to fully update a product to the latest build.
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

DateTimeVersionSizeFile name———————————————————————07-Oct-200421:461.1.4322.20382,052,096System.windows.forms.dll

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: Various errors may occur when you try to call managed code from unmanaged code in Visual C++ .NET 2003

Symptoms
You have a Microsoft Visual C++ .NET 2003 application that uses multiple application domains. When you try to call managed code from unmanaged code in a DLL that has already been loaded in another application domain, you may receive the following error message:

An unhandled exception of type ‘System.NullReferenceException’ occurred in mscorlib.dll
Additional information: Object reference not set to an instance of an object.Note In some scenarios, you may receive one of the following error messages:

DllNotFoundException

Illegal Instruction
Resolution
You may notice this problem if your application contains unmanaged code and uses multiple application domains.
For example, if you have an application that uses multiple application domains that use a set of DLLs, you can successfully load and use these DLLs in the first application domain. However, when you try to call the managed code in one of these DLLs from unmanaged code in a different (second) application domain, the behavior that is mentioned in the “Symptoms” section of this article occurs. The application does not load the managed code in the second application domain because the code has already been loaded in another application domain that is in the same process.