The views and opinions expressed in this blog are those solely of the author(s) and do not necessarily reflect Microsoft’s current policy, position, or branding. For official announcements and guidance on Dynamics 365 apps and services, please visit the Microsoft Dynamics 365 Blog.
Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 release wave 1Discover the latest updates and new features to Dynamics 365 planned through September 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 Timeline
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
If debugging is the process of removing software bugs, then programming must be the process of putting them in. Edsger Dijkstra
I got an error message when the ALM tool was exporting an unmanaged solution from an environment and packaging it up before deploying it.
The ALM tool sometimes errors but usually around data. This problem needed more thinking to resolve it because I wasn’t sure the cause and I hadn’t seen it before.
When I’m not sure of the cause, I remember this quote
If I had an hour to solve a problem, I’d spend 55 minutes thinking about the problem and 5 minutes thinking about solutions — Albert Einstein
Before I solve a problem, I ask myself some questions.
Think before action, create a plan and execute
When debugging, eliminate what isn’t causing the problem and whatever code or customization is left must be the culprit. #HoskWisdom
The error message was my best lead, here it is
Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: An unexpected error occurred.Detail:
<OrganizationServiceFault xmlns:i=”http://www.w3.org/2001/XMLSchema-instance“ xmlns=”http://schemas.microsoft.com/xrm/2011/Contracts“>
<d2p1:value xmlns:d4p1=”http://www.w3.org/2001/XMLSchema“ i:type=”d4p1:string”>Plugin/Microsoft.Crm.WebServices.ExportXmlService</d2p1:value>
<d2p1:value xmlns:d4p1=”http://www.w3.org/2001/XMLSchema“ i:type=”d4p1:string”>Microsoft.Crm.CrmException: An unexpected error occurred. — -> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at Microsoft.Crm.Tools.ImportExportPublish.ThirdPartyComponentPropertiesProvider.GetProperties(String componentKey)
at Microsoft.Crm.Tools.ImportExportPublish.ExportHandler.GetFullUnmanagedPropertyMapForType(String itemType, Boolean managed, IComponentPropertiesProvider componentPropertiesProvider)
at Microsoft.Crm.Tools.ImportExportPublish.ExportHandler.AddXmlProperties(String itemType, XmlDocument importDocument, XmlNode parentNode, IGenericType container, Boolean managed, EntityMetadata entityMetadata, Version targetVersion, IComponentPropertiesProvider componentPropertiesProvider)
at Microsoft.Crm.Tools.Common.ImportExportPublish.EmailTemplateHandler.ExportItem(XmlDocument XDoc, XmlNode Node)
at Microsoft.Crm.Tools.ImportExportPublish.ExportHandler.Export(XmlDocument XDoc)
at Microsoft.Crm.WebServices.ExportXmlService.ExportSolutionWithTargetVersion(String solutionName, Boolean managed, String targetVersion, Boolean exportAutoNumberingSettings, Boolean exportCalendarSettings, Boolean exportCustomizationSettings, Boolean exportEmailTrackingSettings, Boolean exportGeneralSettings, Boolean exportMarketingSettings, Boolean exportOutlookSynchronizationSettings, Boolean exportRelationshipRoles, Boolean exportIsvConfig, Boolean exportSales, Boolean exportExternalApplications, ExecutionContext context)
Here are some facts
The last successful deployment 4 days ago
Did I get the latest from source control? Yes
Is this problem just happening to me? ask someone else to deploy
What was in the patch? one workflow
In the blog post — Dynamics 365 error messages point you in the right direction (yes, I read my blog posts) I got some pointers
To diagnose an error, look at the error with an empty mind #HoskCodeWisdom
Dynamics 365 error messages point you in the right direction but never give you the answer. developers focus on the problem, they forget to think what the error message is telling them.
Don’t rush to solve a bug, before coming up with a solution, understand the problem, identify your assumptions and find out the facts. Debug the code, identify and path the code is taking and then work out what it’s supposed to do.
An example of bug investigation and how to approach fixing bugs
Sherlock Hosk and the case of the annoying bug
Approach bugs with an empty mind and don’t assume what is happening but prove what is happening.
For example –How to diagnose plugin errors in Dynamics 365 it has a good section on plugin error messages
follow these steps
Get someone else to deploy — they did and got the same error
Understand the key parts from the error message and see where it points us. The key parts are below.
Microsoft.Crm.CrmException: An unexpected error occurred. — -> System.IndexOutOfRangeException: Index was outside the bounds of the array
The errors above are saying it’s an IndexOutOfRangeException, in programming terms this means your counter has incremented (plus one) but there are no more records. e.g. you are trying to get row 10 in your index but there are only 9 rows.
The plugins are from Microsoft, note plugins the team created
EmailtemplateHander — it seems like the problem is occurring when we are exporting email templates.
I tried to export the solution from the environment and I got the same error, so the error was nothing to do with the ALM tool. It was a Microsoft problem.
I searched the internet for similar problems, but the problems were different and the solutions were different. The common theme was there was a defective customisation that needed to be removed or recreated, the solution would export after that.
My feeling at this point was somehow one of the email templates (we didn’t have any other templates) had got corrupt. There were 40 so there wasn’t any easy way to identify which one (or ones) was causing the problem. My plan was to take those email templates from another environment and import them over the top.
I tried this, and it worked, and I could go back on with my deployments. It seems easy now but at the time it didn’t make much sense.
It was a tricky problem; I wanted to share my experience, just in case you have a similar experience or are contronted with a problem you aren’t sure how to solve.
Business Applications communities