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

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 view a report in Microsoft Dynamics CRM 3.0: “System.Web.Services.Protocols.SoapException: The feature: “Report history snapshots” is not supported in this edition of Repor …

Symptoms
Consider the following scenario:You install Microsoft Dynamics CRM 3.0 on Microsoft Windows Small Business Server 2003 Release 2 (R2) with Microsoft SQL Server 2005 Workgroup Edition.You view a report in Microsoft Dynamics CRM 3.0.In this scenario, you receive the following error message:

Server Error in ‘/’ Application.
System.Web.Services.Protocols.SoapException: The feature: “Report history snapshots” is not supported in this edition of Reporting Services.
Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: The feature: “Report history snapshots” is not supported in this edition of Reporting Services. at Microsoft.ReportingServices.Diagnostics.Sku.ThrowIfFeatureNotEnabled(String instanceId, RestrictedFeatures feature) at Microsoft.ReportingServices.WebServer.ReportingService.ListReportHistory(String Report, ReportHistorySnapshot[]& ReportHistory) — End of inner exception stack trace — at Microsoft.ReportingServices.WebServer.ReportingService.ListReportHistory(String Report, ReportHistorySnapshot[]& ReportHistory)
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.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: The feature: “Report history snapshots” is not supported in this edition of Reporting Services. —> Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: The feature: “Report history snapshots” is not supported in this edition of Reporting Services. at Microsoft.ReportingServices.Diagnostics.Sku.ThrowIfFeatureNotEnabled(String instanceId, RestrictedFeatures feature) at Microsoft.ReportingServices.WebServer.ReportingService.ListReportHistory(String Report, ReportHistorySnapshot[]& ReportHistory) — End of inner exception stack trace — at Microsoft.ReportingServices.WebServer.ReportingService.ListReportHistory(String Report, ReportHistorySnapshot[]& ReportHistory)
Source Error: 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.
Stack Trace:[SoapException: System.Web.Services.Protocols.SoapException: The feature: "Report history snapshots" is not supported in this edition of Reporting Services. ---> Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: The feature: "Report history snapshots" is not supported in this edition of Reporting Services.at Microsoft.ReportingServices.Diagnostics.Sku.ThrowIfFeatureNotEnabled(String instanceId, RestrictedFeatures feature)at Microsoft.ReportingServices.WebServer.ReportingService.ListReportHistory(String Report, ReportHistorySnapshot[]& ReportHistory)— End of inner exception stack trace —at Microsoft.ReportingServices.WebServer.ReportingService.ListReportHistory(String Report, ReportHistorySnapshot[]& ReportHistory)]System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) +1496System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +218Microsoft.Crm.ReportingServices.ReportingService.ListReportHistory(String Report) +48Microsoft.Crm.Reports.ReportCache.GetSnapshots(String reportPath) +267Microsoft.Crm.Reports.ReportCache.GetReportSnapshotProperties(String reportName) +194Microsoft.Crm.Web.Reporting.SRSViewer.ConfigurePage() +440Microsoft.Crm.Application.Controls.AppPage.OnPreRender(EventArgs e) +20System.Web.UI.Control.PreRenderRecursiveInternal() +62System.Web.UI.Page.ProcessRequestMain() +1499
Resolution
SQL Server 2005 Workgroup Edition is available withWindows Small Business Server R2. However, this problem occurs because this version of SQL Server does not support the Snapshot feature in SQL Server Reporting Services.

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.

BUG: You may receive a “COMException (0×80010105): The server threw an exception” error message in Visual Studio .NET 2003

Symptoms
In Microsoft Visual Studio .NET 2003, if you automate your application to run out-of-process, you may receive a COM exception error message that is similar to the following from the Devenv.exe out-of-processcomponent:

Unhandled Exception: System.ApplicationException: Failed —> System.Runtime.Int
eropServices.COMException (0×80010105): The server threw an exception.at EnvDTE._Solution.Open(String FileName)at DTEAutomation.Class1.Main(String[] args) in c:\vs7play\enterprisetemplate\dteautomation\class1.cs:line 45
— End of inner exception stack trace —at DTEAutomation.Class1.Main(String[] args) in c:\vs7play\enterprisetemplate\dteautomation\class1.cs:line 80
Resolution
This problem occurs because a cached pointer to the selected data is not valid.Then,the Enterprise Template Project is opened.

BUG: Internal Compiler Error C1001 When You Call __assume()

Symptoms
When a function that expects STL::string as a reference is passed as an input argument to the __assume function, you may get the following error message:

repro.cpp(18): fatal error C1001: INTERNAL COMPILER ERROR
(compiler file ‘E:\8447\vc98\p2\src\P2\main.c’, line 494)
Please choose the Technical Support command on the Visual C++Help menu, or open the Technical Support help file for more information.Please refer to the “More Information” section for the sample code that reproduces the problem.
Resolution
Use one of the following two methods to work around this problem:Construct a temporary STL::string object and pass this object as a reference to the function (see workaround 1 in the sample code).Introduce a temporary variable to store the return value of the function, which expects STL::string as reference (see workaround 2 in the sample code).