web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

.NET Framework errors with Workflow 2.0

Dan Peltier Profile Picture Dan Peltier

Hello all!

We have seen and worked through a handful of .NET errors received when working with the new Workflow 2.0 feature. Some of these errors can occur during an upgrade to GP 2015 from a previous version, since part of the upgrade process is to put various DLL’s into SQL as CLR assemblies, and some are received during troubleshooting this. The others are received upon the submission of a workflow.

 

A .NET Framework error occurred during execution of user-defined routine or aggregate "GetAssignedUsers": System.ArgumentNullException: Value cannot be Null

The most common culprit for the “Value cannot be null” error is that the Manager field is blank on the workflow setup. The Manager is set per Workflow type. If the manager field is populated, but the NULL error is still occurring, check a SQL trace and/or the Workflow logs to determine exactly what value is being passed as null.

 

CREATE ASSEMBLY for assembly 'System.IdentityModel' failed because assembly 'System.IdentityModel' failed verification

This error occurs usually during an upgrade, or during the running of the wfDeployCLRAssemblies stored procedure. The error is stating that the SQL server can’t load the System.IdentityModel DLL from Windows as an assembly in SQL. https://social.msdn.microsoft.com/Forums/sqlserver/en-US/d4001fe4-98ab-446b-bef7-1b62ea104c47/sql-server-2012-error-when-creating-assembly-from-systemidentitymodeldll?forum=sqlnetfx

 The resolution is a hotfix for .NET:

http://support.microsoft.com/kb/2742595

If the hotfix doesn’t resolve the issue, you’ll need to repair .NET on the server.

 Method 1: Run the .NET Framework Cleanup Tool.

http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx

Method 2 : Repair the .NET Framework.
http://support.microsoft.com/kb/976982

 

 

A .NET Framework error occurred during execution of user-defined routine or aggregate "GetAssignedUsers": System.IO.FileLoadException: Could not load file or assembly 'System.DirectoryServices

The resolution for this error is to run the following statement in SQL Management Studio:

 

exec wfDeployCLRAssemblies

 

Chances are, you have copied the databases from another SQL instance, likely the SQL instance where the upgrade was performed and the assemblies were first inserted into SQL. Anytime you move your databases, you have to run this statement in order to refresh the assemblies.

 This statement SHOULD return the following results:

 

(1 row(s) affected)

Configuration option 'clr enabled' changed from 1 to 1. Run the RECONFIGURE statement to install.

Warning: The Microsoft .NET Framework assembly 'system.directoryservices, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details.

(This warning statement repeats for each other assembly and dependancy)

 

If you get any red text, then you’ll have to manually drop all the objects related to the wfDeployCLRAssemblies proc. Here is a list of the assemblies, procs, and functions that are created by running the wfDeployCLRAssemblies proc:

Procedures:

GetAssignedUsers

SendWorkflowAssignmentEmail

SendWorkflowCompletionEmail

Functions:

IsValidUserByObjectGuid

IsValidUserByUser

GetUserByObjectGuid

GetObjectGuidByUser

TestEmail

Assemblies:

Microsoft.Dynamics.GP.WorkflowGP.WorkflowEngine

Microsoft.IdentityModel.Clients.ActiveDirectory

Microsoft.Azure.ActiveDirectory.GraphClient

Newtonsoft.Json

System.Web

System.IdentityModel

System.Runtime.Serialization

System.DirectoryServices

 

An error occurred in the Microsoft .NET Framework while trying to load assembly id 65536. The server may be running out of resources, or the assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or UNSAFE. Run the query again, or check documentation to see how to solve the assembly trust issues. For more information about this error:
System.IO.FileLoadException: Could not load file or assembly '
AssemblyName, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.

 

This error is documented in the following KB, and the issue is that the login you used to create the database on the old server doesn’t exist on the new server.

https://support.microsoft.com/en-us/kb/918040

We have also seen this error resolved with a reboot of the SQL server.

A .NET Framework error occurred during execution of user-defined routine or aggregate "GetAssignedUsers": System.IO.FileLoadException: Could not load file or assembly 'System.DirectoryServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050) See Microsoft Knowledge Base article 949080 for more information.

An update to .NET on the SQL server can cause this issue. Try uninstalling KB2901982 if it is installed, then reboot the server.

 

Msg 6517, Level 16, State 1, Line 1

Failed to create AppDomain "master.dbo[ddl].2".

Could not load file or assembly 'System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)

This issue is also usually resolved with a reboot of the SQL Server. Autogrowth or SQL storage settings can cause this, as well as low-memory scenarios that may occur on the SQL server. Make sure you have an upper limit set for the SQL instance and that there's enough RAM to process everything else running on the server.

 

DROP ASSEMBLY failed because the specified assemblies are referenced by assembly 'System.Runtime.Remoting'.

We’ve see this error come up if the customer has previously or currently uses Nodus, which shares a few .NET assemblies with GP. The core shared assemblies are .NET DLL’s pulled from the local GAC of the SQL server. You can usually just drop the assembly and dependent assemblies, and allow GP to re-add the .NET assemblies on behalf of Nodus.

 

Comments

*This post is locked for comments

  • Mitch.M Profile Picture Mitch.M 532
    Posted at

    If anyone receives this error message when approving: "[Microsoft][SQL Server Native Client 11.0][SQL Server]A .NET Framework error occurred during execution of user-defined routine or aggregate "SendWorkflowAssignmentEmail": System.NullReference Exception: Object reference not set to an instance of an object"

    Check to see if doc attach is enabled for the company. I don't know exactly what that stored procedure does since it's encrypted or if there are other potential issues from this message, but enabling doc attach for the company resolved my problem after I did some digging while tracing the process.

    Just a suggestion for some more error handling :) Object reference errors are the worst.

  • Community Member Profile Picture Community Member
    Posted at

    Sheri - Did you get this resolved?  I just wen through again last night.  In the past it was fine because we didn't have Workflow installed so removing the System.Remoting assembly was straight forward.  With Workflow installed many more dependencies needed to be removed first.  Almost all were restored by running EXEC wfDeployCLRAssemblies against the Dynamics database.  Here's a link I found helpful listing all the related assemblies and stored procs.

    community.dynamics.com/.../workflow-2-0-error-microsoft-sql-server-native-client-10-0-sql-server-a-net-framework-error-occurred-during-execution-of-user-defined-routine-or-aggregate-getassignedusers-system-io-fileloadexception-could-not-load-file-or-as

  • Sheri Ibbotson Profile Picture Sheri Ibbotson 712
    Posted at

    Hello Dan,

    We have the .net assembly issue on a system that is running GP2015R2 with Nodus on it.  It looks like a windows .net update damaged the Nodus encryption last week .  Nodus can't reload their code onto this system without dropping the dependent assemblies.  This system does not use and will never use workflow.  In your last thread you said that "you can usually" drop the 'System.Runtime.Remoting' dependent assemblies.  It sounds like you think it’s fairly safe to drop those?  Thank you  

  • Rob Klaproth Profile Picture Rob Klaproth 1,730
    Posted at

    Hi Dan!  Nice meeting you at GPUG this year.   I just had a client run into this issue.   She had created a new server for "testing" GP and copied everything over, I helped her run all the migration scripts and stuff.    However, the transfer GP to a new server document doesn't talk about running the deployclrassemblies so should I add this to my standard operating procedure whenever creating a GP "test" server, or doing a server migration (not upgrade)?  

  • Sheri Ibbotson Profile Picture Sheri Ibbotson 712
    Posted at

    I recently refreshed a gp2015 upgrade to go live - tgis system has nodus as well;  I am encountering this error that locks up 1 user when processing a nodus related credit card process:  Microsoft stated its due to running the 32bit version of SQL2012 and til me to load the 64bit version and that would Fix it? I'm doing that tomorrow night - can you look at this error - I thinks its the same issue shown at the end of your thread.

    Failed to create AppDomain "DYNAMICS.dbo[runtime].6".

    Could not load file or assembly 'System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. Not enough storage is available to process this command. (Exception from HRESULT: 0x80070008)

    1 user registry handles leaked from \Registry\User\S-1-5-21-1603950872-2853542911-4035522611-3111:

    Process 2728 (\Device\HarddiskVolume2\Windows\System32\svchost.exe) has opened key \REGISTRY\USER\S-1-5-21-1603950872-2853542911-4035522611-3111\Printers\DevModePerUser

    I though I would ask - just in case you might know what the real issue is and a way to fix it instead reinstalling the SQL server