Kris' Blog

RSS feed

GameServiceContainer.​GetService<T>() please…

One of the most annoying parts of the XNA framework is that the GameServiceContainer lacks generics. After working with Castle container, the XNA container seems ugly.

If .Net had mixins I would just add it myself but until then please vote for my feature request and here is a workaround.

If you have trouble with the Microsoft Connect link, click on the My Participation link to add a connection.


The operation completed successfully.

The stacktrace says it all.

System.Runtime.InteropServices.COMException (0x80070000): The operation completed successfully. (Exception from HRESULT: 0x80070000)
   at MS.Internal.HRESULT.Check(Int32 hr)
   at System.Windows.Media.SafeProfileHandle.ReleaseHandle()
   at System.Runtime.InteropServices.SafeHandle.InternalFinalize()
   at System.Runtime.InteropServices.SafeHandle.Dispose(Boolean disposing)
   at System.Runtime.InteropServices.SafeHandle.Finalize()

We made this go away by calling GC.WaitForPendingFinalizers() but this can cause deadlocks in WPF since some Finalize() methods use Dispatcher.Invoke().