I'm trying to render a WPF based object as a PNG inside an ASP.NET image handler. We've created a designer in WPF that creates XAML based templates. Using the XAML serializer to store the templates on disk is simple. Pulling those same serialized XAML based objects and reconstituting them in an ASP.NET HTTP handler has proved difficult.
The XAML deserialization process needs to run on a STA thread. Creating a thread and setting it to STA and doing the deserialization and image composition worked, the first time. I get the reconstituted XAML based image created, passed back and sent to the browser. Subsequent calls to the HTTP handler crash the web server with "The calling thread cannot access this object because a different thread owns it."
Are there any libraries out there that will generate an image from a simple XAML based object?