RenderingStatistics Issue

Feb 9, 2010 at 2:03 AM

Anyone else having issues with RenderingStatistics in

Looks like a threading issue but I'm not doing anything too fancy... Just some straight XAML side stuff, a Box, Camera and a Light taken from one of the demos.

System.TypeInitializationException: The type initializer for 'RenderingStatistics8b0a3c0b_b39a_49ff_9d40_bf5bfabaa92a' threw an exception. ---> System.ArgumentException: Current Dispatcher has not been set in DispatcherManager
   at Balder.Silverlight.Notification.DispatcherManager.get_Current()
   at RenderingStatistics8b0a3c0b_b39a_49ff_9d40_bf5bfabaa92a..cctor()

Feb 9, 2010 at 2:18 AM

I was able to get around this by commenting out the throw in Balder.Silverlight.Notification.DispatcherManager... but I'm not sure what's going on :(<font size="5">



//throw new ArgumentException("Current Dispatcher has not been set in DispatcherManager");


Feb 9, 2010 at 7:04 AM


Thanks for pointing this out. The rendering statistics is not used at the moment, so I'll take it out and push a new version today.

Feb 9, 2010 at 7:20 AM

Just updated the release without the RenderingStatistics

Feb 9, 2010 at 10:28 PM


Great work... just saw the sample with materials and rotation...very cool

I've download both source code and just the dll's but ima having this error...


System.Reflection.TargetInvocationException was unhandled by user code
  Message=Exception has been thrown by the target of an invocation.
       at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
       at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
       at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
       at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly)
       at System.Activator.CreateInstance(Type type, Boolean nonPublic)
       at System.Activator.CreateInstance(Type type)
       at Balder.Silverlight.Display.WriteableBitmapQueue.WriteableBitmapQueueStatistics.get_Instance()
       at Balder.Silverlight.Display.WriteableBitmapQueue.UpdateStatistics()
       at Balder.Silverlight.Display.Display.Show()
       at Balder.Silverlight.Display.DisplayDevice.<RenderingManagerShow>b__6(Display d)
       at Balder.Silverlight.Display.DisplayDevice.CallMethodOnDisplays(Action`1 displayAction)
       at Balder.Silverlight.Display.DisplayDevice.RenderingManagerShow()
       at Balder.Silverlight.SoftwareRendering.RenderEventHandler.Invoke()
       at Balder.Silverlight.SoftwareRendering.RenderingManager.ShowTimer(Object sender, EventArgs e)
       at System.Windows.Media.CompositionTarget.OnRendering(Object sender, RenderingEventArgs e)
       at MS.Internal.JoltHelper.RaiseEvent(IntPtr target, UInt32 eventId, IntPtr coreEventArgs, UInt32 eventArgsTypeIndex)
  InnerException: System.TypeInitializationException
       Message=The type initializer for 'WriteableBitmapQueueStatistics49e79951_8cdd_4bd6_8f42_4e853dee76af' threw an exception.
       InnerException: System.ArgumentException
            Message=Current Dispatcher has not been set in DispatcherManager
                 at Balder.Silverlight.Notification.DispatcherManager.get_Current()
                 at WriteableBitmapQueueStatistics49e79951_8cdd_4bd6_8f42_4e853dee76af..cctor()



I think its related to statitiscs...any help?


Feb 9, 2010 at 10:32 PM

Sorry... this happenned at the class WriteableBitmapQueue in this source code:

     public static WriteableBitmapQueueStatistics    Instance
                    lock( InstanceLockObject )
                        if( null == _instance )
                            var weaver = new NotifyingObjectWeaver();
                            var proxyType = weaver.GetProxyType<WriteableBitmapQueueStatistics>();
                            _instance = Activator.CreateInstance(proxyType) as WriteableBitmapQueueStatistics;
                        return _instance;


and this is the xaml:


<Canvas x:Name="gameHolder" Opacity="0.7" Grid.Row="0" Grid.Column="0">
            <Execution:Game x:Name="_game" Width="800" Height="800"  >
                <Execution:Game.Camera >
                    <View:Camera Position="100,50,-100" Target="0,0,0"/>

                <Lighting:OmniLight Position="-100,100,0" Ambient="Brown" Diffuse="Green" Specular="Blue"/>

                <Geometries:Box x:Name="Box" Dimension="20,20,20"/>





Feb 9, 2010 at 10:52 PM

Cool...just coment some lines and its working... :))))

Feb 10, 2010 at 7:39 AM

Forgot to update the source. Will update the source today.