CRM 2015 – How to diagnose plugin errors

failure-to-diagnose

This blog talks about a plugin error which I have seen a number of times when using the Plugin Developer Toolkit, it will discuss how to diagnose plugin errors in general.

Before I talk about plugins can I encourage people to vote on the connect item to get the CRM Developer toolkit working with Visual studio 2013, if you can’t wait for Microsoft to fix it then read my blog post CRM Developer Toolkit Alternatives

Hosk CRM Brain

I like to think of my blog as my CRM brain uploaded to the internet, so whilst reading this you are currently crawling through my CRM brain.  This allows me to search my CRM brain when my real brain forgets how I resolved a problem, actually sometimes I even forget I have experienced a problem and get pleasantly suprised when I have found not only did I have the problem before but I blogged the solution.

The benefit of me blogging about CRM is I benefit and other people who read and search my blog.

My goal in writing articles focused on errors is not only to write about how to resolve the issue but additionally look into the cause of the problem and , the WHY.

Knowledge helps when things go wrong

There is always a difference between theoretical knowledge and practical knowledge.   You can learn the theory of something but find it’s different when you try to use the theory in practical use (e.g. after reading about plugins you then try to write a plugin) you there are gaps in knowledge which you quickly find.

When developers start to plugins they usually go through

  • learn to write plugin code, find lots of errors
  • try to deploy plugin, error haven’t signed the plugin, error permissions etc.
  • Slowly but surely the developers experience fewer problems or problems they know how to resolve

Indepth knowledge of how Microsoft Dynamics CRM works and the underlying plugin infrastructure becomes extremely important when things go wrong.  When errors appear and hold up development, developers need to understand the cause of the error but why it’s complaining, the answer is usually understandable if you understand

  • how the CRM developer toolkit works
  • The various parts of the CRM Developer toolkit
  • The CRM plugin execution framework
  • The roles and privileges needed to deploy plugins

Some useful Hosk Plugin blog posts

The CRM developer toolkit is great (which is why I get annoyed it hasn’t been updated because it automates a lot of the repetitive actions needed to deploy a plugin using the plugin registration tool.) but I feel CRM Developers should learn how to use and deploy plugins using the plugin registration tool.

I use the plugin registration tool to inspect what plugins and steps are deployed and the ability to change the view to see what plugins are deployed for each entity is really useful when investigating bugs on CRM solutions you are not familiar with.

Most of the time you don’t want to mix using the plugin registration tool and the CRM developer toolkit because the CRM developer toolkit will overwrite the changes you make manually next a developer uses it to deploy CRM customizations.

The plugin registration tool is great for viewing the plugins deployed and its portability allows you to use it in customer environments.

If the CRM Developer toolkit gets in a mess you might need to use the plugin registration tool to quickly update or deploy a plugin whilst you fix the plugin developer toolkit.

I had an error previously but the problem was the CRM developer toolkit had got out of sync and I struggled to resolve this problem.  You can read about my frustrations with the CRM Developer toolkit

Dealing with Plugin errors

If When you experience a plugin error I would recommend you first read my blog on common problems because I cover the most common errors.

If you don’t find the answer then stop and think about the potential cause of the problem.  Many developers can go into a mild panic mode when they encounter an error, instead of logically thinking about the problem they instantly go and get a senior developer to help them.

Then when the senior developer is at their desk, they explain the problem.  The process of explaining the problem to the developer, the solution to the problem can become clear.  This is known as rubber ducking or I call this Cardboard developer

When you encounter a plugin problem or CRM developer problems, follow these steps

  1. Stop
  2. Engage Brain\Think
  3. What’s happening?
  4. What should happen?
  5. Make a list of the possible causes of the problem
  6. Investigate your list

If you can’t resolve the problem, you can then at tell the developer what you know, what you have tried.

I don’t encourage any developers to suffer in silence but it’s more beneficial for you own personal learning if you try to understand and resolve problems yourself.  The major benefit of trying to resolve the problem yourself is you get in the habit and become less dependent on the help of your colleagues.

Don’t Assume, know

Don’t Assume, Know is a Hosk mantra I tell myself when investigating problems or debugging.  I have wasted many hours investigating problems and looking for solutions based on an incorrect assumption.  When dealing with problems don’t assume anything, check assumptions and cross them off.  Lots of times you will find the problem.

Plugin Error Messages

The error messages Microsoft Dynamics CRM throws are a mixture of a confusing statement with a nugget of truth tucked inside.  To developers new to CRM development they are just unhelpful messages.

As your experience and knowledge of CRM development increases you will find they often point you in the right direction but you need to have built up a map of the CRM landscape, so you know where to go and check.

Plugin Error Example

This is common error I have experienced a few times but I was trying to deploy a plugin using the CRM developer toolkit and I got this error

Error registering plugins and/or workflows. Plug-in assembly does not contain the required types or assembly content cannot be updated.

Lets break down the message to try and decify the problem

  1. It can’t register the plugin/workflow
  2. Plugin Assembly does not contain required types or the assembly cannot be updated.
  3. So we know the plugin assembly (the DLL) exists but it cannot update it.

The first thing to do is know not assume.  So I opened the Plugin Registration tool and found the DLL.  I could see it had three steps.

I then looked at the RegisterFile.crmregister file and found this had two steps.

The problem was because we were trying to update an assembly with 2 steps but the assembly had 3 steps.  It couldn’t update the assembly because it was too different and this error message was letting us know (in a slightly confusing way).

I have experienced this problem before and the solution to the problem is to unregister the Assembly and install it again.

This problem has occurred when I have created new plugins and sometimes when I have updated a plugin maybe in a different solution but for some reason I couldn’t update the DLL.

In this case how the extra step got into the assembly was a complete mystery but it’s OK to delete the plugin assembly because I knew I was going to deploy it again and install a new version of the Plugin assembly.

Advertisements

Hosk’s Top CRM Articles of the week – 12th June

Article of the Week

The article of the week is my article is the excellent and I want as many people as possible to go and have a look at his first steps in towards creating a developer toolkit replacement.

Possible developer toolkit replacement

I will add my blogs on the subject below

Where is the CRM Developer toolkit for CRM 2015?

CRM Developer Toolkit Alternatives

I will add the Connect suggestion here has 66 votes which is great because a week ago it had 9.

Best of the Rest

XRM code snippets

Some useful Javascript code snippets

CRM 2013 – Disabling a subgrid

Hosk article on how to disable a subgrid without actually disabling it.

Web API preview documentation released

The new Web API stuff, in an odd trial but unsupported offering!!!?!?

New XrmToolBox Plugin: Export to Excel

Don’t be limited by excel when exporting records with the

Getting the CRM Developer toolkit working with Visual Studio 2013

Steps on how to get the current CRM developer toolkit working with visual studio 2013

Upgrade vs Rebuild, Interest vs Responsibility

Good article from CRM MVP Leon Tribe on considering what to do with your customizations when upgrading

Turbo Forms: Get your JavaScript ready for CRM2015 Update 1

Scott Durow gives the lowdown on getting your scripts into shape to be able to use them with the new CRM 2015 SP1 turbo forms.

Create Button in CRM 2013/2015 Form without a Field using Javascript

A button without a field, what is this magic

Dynamics CRM – Security Role Automatically Assigned to imported Teams

Cheeky salesperson role automatically assigned on importing teams.  Probably some kind of reason for this but very annoying if you are not aware of this behaviour

Improve CRM query performance using compatibility version 120 with SQL 2014

Dramatic performance improvement when switching to SQL 2014

Scalability considerations for CRM / SharePoint integration

good article and worth a read

C# Development Tips for Microsoft Dynamics CRM

Great article on implementing C# dev to CRM

Kinect and CRM!!

It’s madness I tell you but it looks cool

PROGRAMMING

“How is Software Like a Skyscraper?”

Martin Fowler – Is Design Dead

great article on YAGNI by Martin Fowler

very interesting article on the history of lean development, I don’t know much about lean development but it sounds like agile without the rubbish bits

http://www.leanessays.com/2015/06/lean-software-development-history.html

Empires fall: Decentralize your code to avoid total collapse

The 8 Best Programming Books to Read Right Now if You Want to Distinguish Yourself

Software engineers are lazy bastards

31 Of The Best Kept Secrets Of Great Programmers

Microsoft: People Have Smaller Attention Span Than A Goldfish

Improving Your Craft with Static Analysis

What’s Fixie and Why Should C# Programmers Care?

TypeScript Futures

OO principles from Head First Design Pattern

The dangers of spaghetti code

OTHER

DESIGN THINKING… WHAT IS THAT?

Do something syndrome

The Disease of Being Busy

Neil Gaimen and Kazuo Ishiguro

Deep Habits: Spend Six Months to Master Skills

Strategy More: Inc. Success Bill Gates Warren Buffett
How Bill Gates, Warren Buffett, and 8 other successful people spent their summer vacations when they were younger

Previous top picks

https://crmbusiness.wordpress.com/2015/06/02/hosks-top-crm-articles-of-the-week-2nd-june/

Useful Hosk Links

Hosk list Of CRM 2013 Tools

A list and review of CRM 2013 tools, this will probably work in CRM 2015 as well

Hosk’s CRM Developer Articles

A collection of my favourite CRM Developer articles I have written

MB2-703 – CRM 2013 Customization and Configuration Certification Information

All the CRM 2013 content to help you pass the exam

HoskWisdom – Hosk Developer Quotes

 Words of Wisdom from the Hosk.  I have written over 900 articles, surely I should have said a few memorable things

Hosk’s Top CRM Articles of the week – 27th March

Article of the Week

Building multi-tenant web apps talking to CRM
Great post from CRM MVP David Yack

Best of the Rest

Microsoft Dynamics CRM 2015 – Global Navigation UI Changes

Have a look at the new CRM 2015 navigation changes

Why developers need to be organised and stop wasting time

A Hosk Developer article about why developers should be organised and structured just like the good code they write

no code alerts from Leon Tribe

I like it when bloggers put codeless or no code solution in the title because I know what I’m going

Tip #349: Bulk delete in bulk over multiple entities

You can bulk delete over multiple entities, I never knew that

CRM 2013 – Error using Plugin Profiler – Could not load file or assembly ‘Microsoft.Xrm.Sdk, Version=5.0.0.0

Interesting error about debugging using the plugin profiler.  The plugin profiler used to debug must match the CRM dll

the CRM chart guy – Add Key Figures to Dashboards in MS Dynamics CRM

Another great blog from the king of CRM charts

CRM 2015 – Workaround for bug: “managed solution cannot be deleted”

Good article about deleting a managed solution which refused to be deleted

CRM 2015 – Understanding the plugin profiler and a puzzling error

A Hosk article about the plugin profiler

CRM 2015 SDK and the CRM 2013 developer toolkit

Getting the CRM 2015 SDK and CRM 2013 dev toolkit to play nicely.  Hey Microsoft where is the CRM Developer toolkit for CRM 2015, it’s been ages

CRM 2013 – How to change the field label size

The settings for changing field label sizes are hidden in the section!

Tip #351: Tracing for plugins and custom workflow activities

Tracing for CRM online

Using the Configuration Data Migration Tool with non-unique display name values

Scott Durow helps people understand and get round this gotcha

Turbo forms in CRM 2015 – interesting article from CRM MVP Mitch Milam

Great blog post from Mitch about the new turbo forms

Rollup fields

CRM MVP Jukka explains how rollup fields work

 

Last Weeks Top CRM Articles

Hosk’s Top CRM Articles of the week – 20th March

Useful Hosk Links

Hosk list Of CRM 2013 Tools

A list and review of CRM 2013 tools, this will probably work in CRM 2015 as well

Hosk’s CRM Developer Articles

A collection of my favourite CRM Developer articles I have written

MB2-703 – CRM 2013 Customization and Configuration Certification Information

All the CRM 2013 content to help you pass the exam

HoskWisdom – Hosk Developer Quotes

 Words of Wisdom from the Hosk.  I have written over 900 articles, surely I should have said a few memorable things

Hosk Blog Most Popular CRM Posts of the Year

I published 202 blogs posts this year!  Which roughly works out at about 4 a week.

Here are the most viewed blog posts this year.  There is a caveat where the posts written at the start of the year have a big advantage over the posts created in the last few months.

I have learnt a lot writing these blog posts and I’m glad they have been viewed so many times

Top 12 blog posts from my blog

1.  MB2-703 – CRM 2013 Customization and Configuration Certification – 7610 views

This page has all of the CRM 2013 Customization and Configuration content I have created to help myself and other people pass the MB2-703 certification.  It works because I passed, which I write about here

2.  CRM 2013 – Setting up Visual Studio with the Developer Toolkit for Microsoft Dynamics CRM – 7478 views

A blog and video tutorial with a step by step guide to setting up the CRM Developer toolkit

3.  CRM 2013 – Step by Step Update Plugin Tutorial using the CRM 2013 Development Toolkit – 7021  views

A blog and video creating a plugin to run on the update stage using the CRM Developer toolkit

4.  CRM 2013 – Understanding Solutions and how they work – 4751 views

A blog post all about Solutions and how they work

5.  CRM 2013 – MB2-703 – CRM 2013 Customization and Configuration Study information – 4362 views

Some study information with links to lots of information including two study guides

6.  CRM 2013 – quick way to get the guid on a form – 4123 views

A quick way to get the guid on a form in CRM 2013, something which as a developer I do all the time.

7.  CRM 2013 – MB2-703 – Customization and Configuration Certification Solution Test Questions – 3857 views

Some test questions on solutions

8.  CRM 2013 – Plugins – Simple update plugin – Redeploying, improving and updating – 3656 views

This blog shows you how to redeploy your plugin with a few changes

9.  CRM 2013 – Javascript to get id of current record – 2613 views

A quick blog which shows you how to get the Guid of the form

10.  CRM 2011/2013 – Javascript to get the object type code of an entity – 2532 views

It’s important to get the object type code programatically because as I found you cannot hard code this value because it could be different in different CRM instances (e.g. DEV, TEST, PROD)

11.  CRM 2013 – How to set up Field Level Security – 2555 views

A blog showing how Field Level security works

12.  CRM 2013 – Workflow to set the current date and time – 2532 views

A workflow which sets the current date and time