.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 ‘CRM’

Error message when you view an activity form in Microsoft Dynamics CRM 4.0: “Exception of type ‘System.Web.HttpUnhandledException’ was thrown”

Symptoms
When you view an activity form in Microsoft Dynamics CRM 4.0, you receive the following error message:

Error: Exception of type ‘System.Web.HttpUnhandledException’ was thrown.Error Message: 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.Error Details: Exception of type ‘System.Web.HttpUnhandledException’ was thrown.Source File: Not availableLine Number: Not availableRequest URL: http://URL
Stack Trace Info: [ArgumentNullException: Key cannot be null.Parameter name: key]at System.Collections.Hashtable.ContainsKey(Object key)at System.Collections.Hashtable.Contains(Object key)at Microsoft.Crm.Metadata.PreloadedMetadataCacheDataProvider.TryGetEntity(String entityName, NameMappingType mapping)at Microsoft.Crm.Metadata.DynamicMetadataCache.GetEntity(String entityName, NameMappingType mapping)at Microsoft.Crm.Security.User.HasPrivilege(IUser user, String entityName, PrivilegeType privilegeType, PrivilegeDepth privilegeDepth)at Microsoft.Crm.Security.User.HasPrivilege(IUser user, String entityName, AccessRights accessRights, PrivilegeDepth privilegeDepth)at Microsoft.Crm.Security.User.HasPrivilege(IUser user, String entityName, AccessRights accessRights)at Microsoft.Crm.Application.Components.Sdk.FormControls.Web.LookupControl.set_LookupTypes(Int32[] value)at Microsoft.Crm.Application.Components.Sdk.FormControls.Web.LookupControl.set_Metadata(AttributeMetadata value)at Microsoft.Crm.Application.ControlActivator.CreateControl(ControlDescriptor controlDescriptor, String clientId)at Microsoft.Crm.Application.Forms.CrudForm.BuildFormModel(FormDescriptor formDescriptor)at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, String formType)at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity)at Microsoft.Crm.Web.Activities.BasicActivityPage.ConfigureForm()at Microsoft.Crm.Web.Activities.PhoneCallDetailPage.ConfigureForm()at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)at System.Web.UI.Control.PreRenderRecursiveInternal()at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Resolution
This problem occurs because the FormDescriptor object caches some entity metadata. Therefore,an ArgumentNullException exception occurs.

Error message when you upgrade to Microsoft Dynamics CRM 4.0: “Exception has been thrown by the target of an invocation”

Symptoms
When you upgrade to Microsoft Dynamics CRM 4.0, the upgrade process cannot be completed. Additionally, you receive the following error message in the CRM40setup.log file:

Time|Info| Updating precision and scale of decimal attributes
Time|Error| System.Exception: Action
Microsoft.Crm.Setup.Server.InstallDatabaseAction failed. —>
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Data.SqlClient.SqlException: The statistics ‘hind_1090102924_1A_2A_4A_9A_15A’ is dependent on column ‘Quantity’.
ALTER TABLE ALTER COLUMN Quantity failed because one or more objects access this column.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Crm.CrmDbConnection.InternalExecuteNonQuery(IDbCommand command)
at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command, Boolean impersonate)
at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command)
at Microsoft.Crm.Setup.DiffBuilder.UpdatePrecisionAndScaleOnDecimalAttributes()
— End of inner exception stack trace —
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.Crm.Setup.Database.DllMethodAction.Execute()
at Microsoft.Crm.Setup.Database.DatabaseInstaller.ExecuteReleases(ReleaseCollection releases, Int32 currentProgress)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.installInternal()
at Microsoft.Crm.Setup.Database.DatabaseInstaller.Install(Int32 languageCode, String configurationFilePath, Boolean upgradeDatabase)
at Microsoft.Crm.Setup.Server.InstallDatabaseAction.Do(IDictionary parameters)
at Microsoft.Crm.Setup.Common.Action.ExecuteAction(Action action, IDictionary parameters, Boolean undo)
— End of inner exception stack trace —, Error, RetryCancel, Option1Note By default, the CRM40setup.log file is in the following folder:
C:\Documents and Settings\upgrading user\Application Data\Microsoft\MSCRM\logs
This problem occurs if you have custom statistics in the OrgName_MSCRM database.
Resolution
This problem occurs because the upgrade process cannot handle custom statistics in the OrgName_MSCRM database.

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 view the service calendar in Microsoft Dynamics CRM 3.0: “An unhandled exception was generated during the execution of the current web request”

Symptoms
You cannot view the service calendar in Microsoft Dynamics CRM 3.0. Additionally,you receive the following error message:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Resolution
This problem occurs when you have working hours set in Microsoft Dynamics CRM 3.0 and when one of the following conditions is true: You change time zones on your computer.You change from daylight saving time to standard time,or you change fromstandard time to daylight saving time.

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.

Error message when you try to run a report or upload a report in Microsoft Dynamics CRM: “The request failed with HTTP status 401: Unauthorized” or “Server Error in ‘/’ Application”

Symptoms
Symptom 1When you try to run a report in Microsoft Dynamics CRM 3.0, you receive the following error message:

The request failed with HTTP status 401: Unauthorized.When you try to run a report in Microsoft Dynamics CRM 4.0, you receive the following error message:

An error occurred while trying to add the report to Microsoft Dynamics CRM.
Try this action again.If the problem continues, check the Microsoft Dynamics CRM Community for solutions or contact your organization’s Microsoft Dynamics CRM Administrator.Finally, you can contact Microsoft Support.
Error code:0×80048298
Symptom 2Consider the following scenario in Microsoft Dynamics CRM: You build a custom report by using Microsoft Visual Studio 2003 or by using a similar tool.You try to upload the report to the Microsoft Dynamics CRM system. In this scenario, you receive the following error message:

Server Error in ‘/’ Application. Exception of type Microsoft.Crm.CrmException was thrown. If the DevErrors parameter is enabled, you receive this error messageon the screen.
This error message occurs in some configurations. For example, this error message may occur if the following conditions are true:The following products are installed on the same server:Microsoft SQL ServerSQL Server Reporting Services (SRS)Microsoft Dynamics CRM is installed on a separateserver.
Resolution
This problem occurs because the security account for the CRMAppPool application pool does not have the Publisher for Microsoft Dynamics CRM role in Report Manager.