Wednesday, March 11, 2015

Silverlight "ArgumentException: An item with the same key has already been added" when attempting to print a report

It's been about 3 months now since working with Microsoft Dynamics GP 2015 in our production environment. To recap, at Intelligent Partnerships we run all our information technology infrastructure on Microsoft Azure. A big reason for this, of course, is the high degree of mobility required by our consulting staff and the ability to access demo environments and be able to enter timesheets and expenses from anywhere in the world they happen to be. In addition, we need to be able to run our business and access our financials and analytics without being constrained to a particular geographical location. As such we rely heavily on Dynamics GP's Web Client and Business Analyzer to achieve these goals.

One of the issues we started noticing with Web Client recently is, when you attempt to print a report - Standard or Template - but cancel out the printing on the Report Destination window, then attempt to print the report once more, we would receive the following Silverlight error message:

Severity: Critical Summary: A server side exception of type "ArgumentException" has occurred. Details: ArgumentException: An item with the same key has already been added. at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Microsoft.Dynamics.GP.Web.Services.Runtime.Dexterity.Hierarchy`1.Add(T ancestor, T item) at Microsoft.Dynamics.GP.Web.Services.Runtime.Dexterity.Implementation.WCDexRuntimeStateResourceManager.Register(DexUri parentId, IWCDexWindow window) at Microsoft.Dynamics.GP.Web.Services.Runtime.Dexterity.Implementation.Adapters.WCDexFormOpenStateChangedNotificationAdapter.Notifications_FormOpenStateChanged(Object sender, DexUriEventArgs`1 e) at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at Microsoft.Dexterity.Runtime.Interop.DexNotification.OnFormOpenStateChanged(DexUri uri, DexFormOpenState value) at Microsoft.Dexterity.Runtime.Interop.Win32.NativeMethods.MsaCommandExec(Int16 tag) at Microsoft.Dexterity.Runtime.Interop.Win32.NativeMethods.<>c__DisplayClass26.b__25() at Microsoft.Dexterity.Runtime.Interop.Win32.NativeMethods.ExecuteMsaAction(Func`1 interopAction, String entryPoint) at Microsoft.Dexterity.Runtime.Interop.Win32.NativeMethods.MacroSystemCommandExecute(Int16 tag) at Microsoft.Dexterity.Runtime.Interop.DexMacroSystem.CommandExecute(Int16 tag) at Microsoft.Dynamics.GP.Web.Services.Runtime.Dexterity.Implementation.WCDexMessageProcessor.ProcessCommandExecuteInstanceResourceMessage(IWCDexMessage msg) at Microsoft.Dynamics.GP.Web.Services.Runtime.Dexterity.Implementation.WCDexMessageProcessor.Process(IWCDexMessage message) at Microsoft.Dynamics.GP.Web.Services.Runtime.Dexterity.DexRuntimeStateManager.SendMessage(IWCDexMessage message) at Microsoft.Dynamics.GP.Web.Services.Runtime.Dexterity.DexRuntimeStateManager.MainEventLoop()

This particular error was received attempting to print a sales order processing quote, but we have been able to reproduce from other windows. While I don't claim to understand all these exceptions, this particular one seems to refer to an issue caused by a "key" being added twice to the same "Generic.Dictionary" collection. Since the action causing the error seems to be a second attempt at printing a report - the same report it seems - somewhere along the lines it would appear that some value isn't being cleared out from the collection of reports being printed which would cause a duplicate key. Again, pure speculation.

Nonetheless, in speaking to the Dynamics GP development team, it seems to be this issue has been written up and may be solved in the upcoming hotfix release. This issue can be reproduced in Microsoft Dynamics GP 2015 build 14.00.0619 (January Hotfix).

Until next post!

MG.-
Mariano Gomez, MVP
Intelligent Partnerships, LLC
http://www.intelligentpartnerships.com/

No comments: