SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components


We’re developing an extra web based front end for what was until now a monolithic WPF .Net 4.72 application and want to add a small service that we can host a REST API, that when given a GUID, can render the data into a scichart exported bitmap.

My plan was to use ASP.NET core to do this as the rest of web application will be done using this, but although I can install the scichart package, I can’t find a way to reference the Presentation Core dlls (needed for amongst other things the colors and content control stuff).

The project sdk is Microsoft.NET.Sdk.Web, but I can’t figure out how to do this.

  • You must to post comments

It turns out simpler than I thought I needed to add the following to the project file:

FrameworkReference Include=”Microsoft.WindowsDesktop.App.Wpf

This does mean you will be restricted to running the service on a windows machine though so be aware of that.

Then because the SciChart stuff needs to run in an STA thread (the core project is MTA). You need to run it in a separate thread in the Get of the controller:

public IActionResult Get()

        byte[] bytes = null;
        Thread newWindowThread = new Thread(new ThreadStart(() =>
            var bs = CreatChart();
            var encoder = new PngBitmapEncoder();

            using (MemoryStream stream = new MemoryStream())
                bytes = stream.ToArray();


        // set the apartment state  

        // make the thread a background thread  
        newWindowThread.IsBackground = true;

        // start the thread  

        return File(bytes, "image/png");


  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.