"Plug-in assembly fullnames must be unique" on updating plugin registration - dynamics-crm-2011

Dynamics CRM 2011 on premise.
I registered a custom workflow assembly using the Plugin Registration Tool.
The plugin code was:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
namespace CreateDirectDebit
{
public class CreateDirectDebit : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
}
}
}
This was successful.
Then I change the code to this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Activities;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
namespace CreateDirectDebit
{
public class CreateDirectDebit : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
// Create the tracing service
ITracingService tracingService = context.GetExtension<ITracingService>();
if (tracingService == null)
throw new InvalidPluginExecutionException("Failed to retrieve the tracing service.");
tracingService.Trace("CreateDirectDebit.Execute, 1");
throw new InvalidPluginExecutionException("Testing dialog custom workflow.");
}
}
}
When I update the assembly using the Plugin Registration Tool I get this error on pressing Update Selected Plugins:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Plug-in assembly fullnames must be unique (ignoring the version build and revision number).
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ErrorCode>-2147204741</ErrorCode>
<ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Plug-in assembly fullnames must be unique (ignoring the version build and revision number).</Message>
<Timestamp>2013-10-14T10:04:55.4528719Z</Timestamp>
<InnerFault>
<ErrorCode>-2147204741</ErrorCode>
<ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Plug-in assembly fullnames must be unique (ignoring the version build and revision number).</Message>
<Timestamp>2013-10-14T10:04:55.4528719Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<TraceText i:nil="true" />
</OrganizationServiceFault>
Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Xrm.Sdk.IOrganizationService.Update(Entity entity)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.UpdateCore(Entity entity)
at Microsoft.Crm.Tools.PluginRegistration.RegistrationHelper.UpdateAssembly(CrmOrganization org, String pathToAssembly, CrmPluginAssembly assembly, PluginType[] type)
at Microsoft.Crm.Tools.PluginRegistration.PluginRegistrationForm.btnRegister_Click(Object sender, EventArgs e)
The same error occurs if I revert the code to the first version and try to update the assembly.
What have I done wrong?

This usually arises for one of two reasons:
You've clicked Register rather than Update in the Plugin Registration Tool
You've clicked Update but you had selected the wrong plugin/workflow assembly to update.

In Dynamics CRM 2011 plugin and workflow assemblies can be updated as long as name, public key, major version and minor version of existing and new assemblies are the same. If the minor version of your assembly has been incremented (your VS build may have done this automatically), then both are considered to be different.
They can however be registered side-by-side. Just register the new version and remove the old one.

In my case, I received this error when trying to update a plugin.
The plugin I had selected to update in the Registered Plugins & Custom Workflow Activities area wasn't correct. The names were very similar so I didn't notice at first.
By selecting the correct plugin to update from the list, I was able to continue with the update.

Your assembly must be strongly signed with the full strongname matching. The two most likely culprits are the version number and that you've used a different key to sign the assembly.
I wrote up a blog post with more info:
PLUGIN ASSEMBY FULLNAMES MUST BE UNIQUE
http://helpfulbit.com/plugin-assemby-fullnames-must-be-unique/

Related

Missing reference to netstandard for Cppsharp program

I'm trying to start my first project with Cppsharp using Visual Studio 2015, following the getting started guide.
The steps I followed were to:
Create new C# console project
Install Cppsharp using Nuget
Add references to Dlls into the project
Create C# source file based on the example in this old post
Whilst the example in the post is old, it still seems to be consistent with the getting started guide. The full program is listed below.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CppSharp;
namespace CppSharpTest
{
class Program
{
class DllDemoGenerator : ILibrary
{
static void Main(string[] args)
{
ConsoleDriver.Run(new DllDemoGenerator());
}
void Setup(Driver driver)
{
var options = driver.Options;
options.GeneratorKind = LanguageGeneratorKind.CSharp;
options.LibraryName = "DllDemo";
options.Headers.Add("DllDemo.h");
options.Libraries.Add("DllDemo.lib");
}
public void SetupPasses(Driver driver) { }
public void Preprocess(Driver driver, CppSharp.AST.Library lib) { }
public void Postprocess(CppSharp.AST.Library lib) { }
}
}
}
However, I am already facing errors See image:
CS0012 C# The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=...'
I was not able to find a way to add this reference. One solution I found proposed to target a higher .NET version (4.7.2) and I tried this, but the error still remains.
Can anyone help to overcome this problem?
Posted the same question on the Github page and was recommended to upgrade from VS2015
Installing VS2019 removed this error

Windows azure redis cache migration issue

We are hosting our site on windows azure where site is running on multiple instances.Due to multiple instances we were using shared cache for storing session values. As Microsoft is going to stop shared cache and recommended to use redis cache to store session. I modified project to use redis cache and it worked for most of the pages. My problem is that, we have a very important page "search page" (we are using lucene.net for search functionality) in our site which stores a lot of data in session and this page is not working. After hitting search button, it shows connecting status in address bar for a long time and goes to oops page of website. We are recording error messages in DB so after looking at there we found following error message.
System.Runtime.Serialization.SerializationException: Type 'myWeb.clsSearchCriteria+ContentCriteria' in Assembly 'HelmBriscoeWeb, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)
at Microsoft.Web.Redis.RedisUtility.GetBytesFromObject(Object data)
at Microsoft.Web.Redis.RedisUtility.AppendUpdatedOrNewItemsInList(ChangeTrackingSessionStateItemCollection sessionItems, List`1 list)
at Microsoft.Web.Redis.RedisConnectionWrapper.TryUpdateIfLockIdMatchPrepare(Object lockId, ISessionStateItemCollection data, Int32 sessionTimeout, String[]& keyArgs, Object[]& valueArgs)
at Microsoft.Web.Redis.RedisConnectionWrapper.TryUpdateIfLockIdMatch(Object lockId, ISessionStateItemCollection data, Int32 sessionTimeout)
at Microsoft.Web.Redis.RedisSessionStateProvider.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
at System.Web.SessionState.SessionStateModule.OnEndRequest(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I am not sure if this is related to my problem but seems if this is fixed, page will work properly. Has anyone any idea why this error occurred and how can I fix it?
Thanks
I solved this problem myself by adding serialization attribute to class like below.
<Serializable()> _
Public Class clsSearchCriteria
Thanks

"System.Workflow.Runtime.Hosting.PersistenceException" Custom SharePoint Sequential workflow

I am getting following error in sharepoint Logs for my SharePoint Visual Studio Sequential workflow having a custom activity.
The custom activity is created through Component Class.
I am not sure why this error is coming? Please help!!!
System.Workflow.Runtime.Hosting.PersistenceException: Type 'System.ComponentModel.Container' in Assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. ---> System.Runtime.Serialization.SerializationException: Type 'System.ComponentModel.Container' in Assembly 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() at System.Runtime.Serialization.Formatters.Binary.WriteObjectInf... 3d93366f-a701-476c-91c9-d2153911486b
03/22/2012 12:38:36.31* w3wp.exe (0x049C) 0x1620 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected ...o.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter) at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph) at System.Workflow.ComponentModel.Activity.Save(Stream stream, IFormatter formatter) at System.Workflow.Runtime.Hosting.WorkflowPersistenceService.GetDefaultSerializedForm(Ac... 3d93366f-a701-476c-91c9-d2153911486b
03/22/2012 12:38:36.31* w3wp.exe (0x049C) 0x1620 SharePoint Foundation Workflow Infrastructure 98d4 Unexpected ...tivity activity) at Microsoft.SharePoint.Workflow.SPWinOePersistenceService.SaveWorkflowInstanceState(Activity instanceState, Boolean unlock) at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation) --- End of inner exception stack trace --- at System.Workflow.Runtime.WorkflowExecutor.Persist(Activity dynamicActivity, Boolean unlock, Boolean needsCompensation) at System.Workflow.Runtime.WorkflowExecutor.ProtectedPersist(Boolean unlock) 3d93366f-a701-476c-91c9-d2153911486b
Thanks!
The Issue was because when i changed the Component class to Sequential Activity I had Activity properties e.g. 'A' & 'B'. Then i added this activity to VS toolbox. At this stage it was working fine.
Now when I changed the activity code to change its property to 'A' & 'C' and i also removed a Constructor having parameter as 'Container' object.
When i re-compiled this Activity and refresh its DLL. In workflow designer the Activity was not getting refreshed i.e. its toolbox was still pointing to old dll.
To Resolve for this i closes and opened the VS again, VOILA the designer is now getting updated Activity with new properties.
This was i think was limitation of VS toolbox that it is not getting refreshed in-spite of dll for that activity is updated.
Thanks!
Can you access the source XAML for the workflow? See if a "Container" object is being included, and if it's necessary to have it there. If you can remove it and still have the workflow run properly, this may fix the issue.

CRM 2011 plugin with no code returns "The given key was not present in the dictionary"

I wrote a plugin to update some data on a salesorder, right after the user has updated the record itself. Based on whether certain dates were changed, I want to update another field with a formatted date.
I ran across the error "The given key was not present in the dictionary" so I added a few traces to see where it exactly returned the error. I then discovered that the trace never wrote out, so I assumed the code I wrote never gets executed. This is indeed the case because if I just do
public class SalesOrderPlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
}
}
I get the same error:
Unhandled Exception: System.ServiceModel.FaultException`1
[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:
Unexpected exception from plug-in (Execute): Iu.PreConsultants.Crm.SalesOrderPlugin:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Unexpected exception from plug-in (Execute): Iu.PreConsultants.Crm.SalesOrderPlugin: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.</Message>
<Timestamp>2012-02-21T07:09:48.471378Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText>
[Iu.PreConsultants.Crm: Iu.PreConsultants.Crm.SalesOrderPlugin]
[1486b5df-595c-e111-b7b0-46c950e6c8cd: Iu.PreConsultants.Crm.SalesOrderPlugin: Update of salesorder]
</TraceText>
</OrganizationServiceFault>
The settings for the plugin:
Post-validation
Synchronous execution mode
Server deployment
On a hosted setup (sandboxed)
SalesOrder has been altered and has some custom attributes.
Any help on this would be greatly appreciated!
Kind regards,
Vincent
Ok it works now. It seems like glosrob was right and there was a cached version kept by CRM. I tried to use "Update" on the IPlugin implementations on the registrationtool from the SDK but that wasn't sufficient. I had to Update the Assembly first, and after that, the IPlugin implementations also got updated.

Failure Loading Of Event Receiver Assembly

I have the following code snippet in my feature.xml
<Feature Id="0c272f81-49c0-440a-a544-677d51a8ffe4"
ReceiverAssembly="FeaturedMasterPage, Version 1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5"
ReceiverClass="FeaturedMasterPage.FeatureEventReciever"
Title="Branding202"
Scope="Web"
Version="1.0.0.0"
Hidden="FALSE"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Branding202\Module.xml" />
<ElementFile Location="Branding202\Branding202.Master" />
</ElementManifests>
</Feature>
My FeatureEventReciever.cs says:-
using System;
using System.Collections.Generic;
using Microsoft.SharePoint;
using System.Text;
using System.Diagnostics;
namespace FeaturedMasterPage
{
class FeatureEventReciever:SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
try
{
//My Code
}
catch (Exception)
{
throw;
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
try
{
//My Code
}
catch (Exception)
{
throw;
}
}
public override void FeatureInstalled(SPFeatureReceiverProperties properties) { }
public override void FeatureUninstalling(SPFeatureReceiverProperties properties) { }
}
}
When i try to deploy the solution...it gives me the following error:-
Error 1 Feature '0c272f81-49c0-440a-a544-677d51a8ffe4' could not be installed because the loading of event receiver assembly "FeaturedMasterPage, Version 1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5" failed: System.IO.FileLoadException: Could not load file or assembly 'FeaturedMasterPage\, Version 1.0.0.0\, Culture\=Neutral\, PublicKeyToken\=9f4da00116c38ec5' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
File name: 'FeaturedMasterPage\, Version 1.0.0.0\, Culture\=Neutral\, PublicKeyToken\=9f4da00116c38ec5'
at System.Reflection.AssemblyName.nInit(Assembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
0 0
I have already spent whole day troubleshooting this. I have installed the dll using gacutil.
Any help would be appreciated.
Maybe it's just something gone wrong in StackOverflow automatic formatting, but I don't see the "equals" sign in your assembly's full name (at the ReceiverAssembly="...." part).
Should be
FeaturedMasterPage, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5
What I see is
FeaturedMasterPage, Version 1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5
Unfortunately I doubt the issue is with your code but rather the path, of which only you can fix.
Verify your assembly name.
Verify your full class name.
Verify your assembly is getting included in the solution file.
If you get past number three then it's a SharePoint issue but judging by the errors, I can almost guarantee you that it's simply a bad reference.
Can you try loading the assembly manually via PowerShell?
Try to rename the Assembly by right clicking the project name >> Properties >> from the Application tab rename both of the "Assembly Name" and "Default namespace" to be the same name. I faced this problem before and that was the solution for it. Hope it helps you.

Resources