The system caught this execption: (System.ArgumentException:. Has been added with the same key entry)
:
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
System.Collections.Generic.Dictionary`2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.Add(KeyValuePair`2 keyValuePair)
Telerik.Windows.Documents.FormatProviders.DocumentFormatProvidersManager.RegisterFormatProvider(IDocumentFormatProvider provider)
ProjectManagePlatform.UI.Common.ExamplesFormatProvidersManager.RegisterFormatProviders()}
When the system runs in if{} shown below, it throws the execption.
Codes Below:
using Telerik.Windows.Documents.FormatProviders;
using Telerik.Windows.Documents.FormatProviders.Html;
using Telerik.Windows.Documents.FormatProviders.OpenXml.Docx;
using Telerik.Windows.Documents.FormatProviders.Pdf;
using Telerik.Windows.Documents.FormatProviders.Txt;
using Telerik.Windows.Documents.FormatProviders.Xaml;
public static class ExamplesFormatProvidersManager
{
private static bool isRegistered = false;
/// <summary>
/// This method is used only to work around limitations for using MEF in Examples.
/// </summary>
public static void RegisterFormatProviders()
{
if (!isRegistered)
{
DocumentFormatProvidersManager.RegisterFormatProvider(new XamlFormatProvider());
DocumentFormatProvidersManager.RegisterFormatProvider(new HtmlFormatProvider());
DocumentFormatProvidersManager.RegisterFormatProvider(new DocxFormatProvider());
DocumentFormatProvidersManager.RegisterFormatProvider(new TxtFormatProvider());
DocumentFormatProvidersManager.RegisterFormatProvider(new PdfFormatProvider());
isRegistered = true;
}
}
}