Pre loader

Issue with Chart events

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
0
0

I have 2 charts in my application. They work fine until I add an event to the chart (xaml). The Designer gives an Unhandled Exception with the following details

System.ArgumentException
An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.Expression.DesignModel.Metadata.MemberCollection.get_FieldIndex()
at Microsoft.Expression.DesignModel.Metadata.MemberCollection.CreateField(String fieldName, MemberKey& key)
at Microsoft.Expression.DesignModel.Metadata.MemberCollection.CreateMember(MemberType memberTypes, String memberName, MemberKey& key)
at Microsoft.Expression.DesignModel.Metadata.MemberCollection.TryGetCachedMember(MemberType memberTypes, String memberName, Boolean create, IMember& member)
at Microsoft.Expression.DesignModel.Metadata.MemberCollection.GetMember(MemberType memberTypes, String memberName, MemberAccessTypes access)
at Microsoft.Expression.DesignModel.Metadata.ProjectContextType.GetMember(MemberType memberTypes, String memberName, MemberAccessTypes access)
at Microsoft.Expression.Markup.XamlTypeHelper.GetPropertyKey(XamlParserContext parserContext, ITextLocation lineInformation, XmlNamespace xmlNamespace, String typeAndPropertyName, XmlNamespace targetTypeNamespace, IType targetTypeId, MemberType memberTypes, MemberType defaultType, Boolean allowProtectedPropertiesOnTargetType)
at Microsoft.Expression.Markup.XamlParser.GetPropertyKey(XamlParserContext parserContext, XmlElementReference xmlElementReference, XmlElement xmlElement, XmlAttribute attribute, IType targetType, Boolean allowProtectedPropertiesOnTargetType, IProperty& propertyKey)
at Microsoft.Expression.Markup.XamlParser.AddPropertiesAndChildren(XamlParserContext parserContext, DocumentCompositeNodeReference nodeReference, XmlElementReference xmlElementReference, XmlElement xmlElement, Predicate
1 propertyFilter)
at Microsoft.Expression.Markup.XamlParser.AddPropertiesAndChildren(XamlParserContext parserContext, DocumentCompositeNodeReference nodeReference, XmlElementReference xmlElementReference, XmlElement xmlElement)
at Microsoft.Expression.Markup.XamlParser.ParseCompositeElement(XamlParserContext parserContext, IDocumentNodeReference nodeReference, IType typeId, XmlElementReference xmlElementReference, XmlElement xmlElement)
at Microsoft.Expression.Markup.XamlParser.ParseElementContent(XamlParserContext parserContext, IDocumentNodeReference nodeReference, IType typeId, XmlElementReference xmlElementReference, XmlElement xmlElement)
at Microsoft.Expression.Markup.XamlParser.ParseElement(XamlParserContext parserContext, IDocumentNodeReference nodeReference, XmlElementReference xmlElementReference, XmlElement xmlElement, DocumentNode& node)
at Microsoft.Expression.Markup.XamlParser.ParseRegion(IReadableSelectableTextBuffer textBuffer, DocumentNode parentNode, DocumentNode oldNode, ITextRange span, IList1& errors)
at Microsoft.Expression.Markup.XamlLanguageService.IncrementalParse(ITextChangesTracker textChanges, IList
1 errorsAndWarnings, IList`1& newErrors)
at Microsoft.Expression.Markup.MarkupDocument.CommitTextEdits(Boolean forceUpdateIfWarnings)
at Microsoft.Expression.DesignSurface.View.SceneView.CommitTextEditsInternal(Boolean forceUpdateIfWarnings)
at Microsoft.Expression.DesignSurface.View.SceneView.SynchronizeTextEdits()
at Microsoft.Expression.DesignSurface.View.SceneView.StopTimerAndCommitTextEdits()
at Microsoft.Expression.DesignSurface.View.SceneView.TextCommitTimeoutTimer_Tick(Object sender, EventArgs e)
at System.Windows.Threading.DispatcherTimer.FireTick(Object unused)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at Microsoft.Expression.DesignHost.Isolation.DesignerProcess.RunApplication()
at Microsoft.Expression.DesignHost.Isolation.DesignerProcess.<>c__DisplayClass2.

b__0()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

The Chart code is as below. If I remove the Preview mouse down and reload then it woks fine.

        <s:SciChartSurface x:Name="sciChartFull" s:ThemeManager.Theme="Chrome" Grid.Column="0" PreviewMouseDown="sciChartFull_PreviewMouseDown"  >
            <s:SciChartSurface.RenderableSeries>
                <s:FastLineRenderableSeries x:Name="lineSeriesFull" SeriesColor="#FFBB6464" />
                <s:XyScatterRenderableSeries x:Name="pointSeriesFull">
                    <s:XyScatterRenderableSeries.PointMarker>
                        <s:EllipsePointMarker Width="5" Height="5" Fill="#FF04571B" Stroke="#FF04571B" StrokeThickness="1"></s:EllipsePointMarker>
                    </s:XyScatterRenderableSeries.PointMarker>
                </s:XyScatterRenderableSeries>
            </s:SciChartSurface.RenderableSeries>
            <s:SciChartSurface.XAxis>
                <s:TimeSpanAxis DrawMajorGridLines="False" DrawMinorGridLines="False" />
            </s:SciChartSurface.XAxis>
            <s:SciChartSurface.YAxis>
                <s:NumericAxis DrawMajorGridLines="False" DrawMinorGridLines="False" Visibility="Collapsed"/>
            </s:SciChartSurface.YAxis>
        </s:SciChartSurface>
  • You must to post comments
Best Answer
0
0

Hi Julian,

Many thanks for reporting this issue. I just created a new solution to reproduce it, and pasted in your XAML. I am using SciChart v3.3.3.6243 which I got from our Nuget feed. I am using Visual Studio 2013 Update 4.

Now predictably, I don’t get a designer exception with the event, or without it…

Does this solution (attached) reproduce the issue on your PC? (You may need to right-click solution explorer and Enable NuGet Package Restore);

If so, what version of Visual Studio are you using, and what patch (what update)? We have seen many designer errors go away when the latest Visual Studio patch is applied.

Best regards,
Andrew

Attachments
Images
  • Julian Muscat
    It seems I was using a old Visual Studio version. Upgraded to 2013 update4 as suggested and now seems ok. Thanks
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies