Thursday, October 13, 2016

Orleans: Unsupported Type encountered–Part 2

This is a continuation of a previous post. Quick recap, I got an “Unsupported Type encountered” error when trying to send a message from an Orleans client to a silo.

I tried a lot of other things (adding and removing the [Serializable] attribute, creating a custom serializer, …) before I landed at the real solution.

When comparing our code with a sample I created using the Orleans template project in Visual Studio, I noticed that I had a specific NuGet package missing:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Orleans.Core" version="1.2.4" targetFramework="net452" />
  <package id="Microsoft.Orleans.OrleansCodeGenerator.Build" version="1.2.4" targetFramework="net452" />
</packages>

Without this package doesn’t integrate in your build pipeline. Why is this important? Because behind the scenes Orleans is generating code for your grain messages.  You can see this generated code by expanding the Properties of your project:

image

Inside you’ll find an orleans.codegen.cs file that contains all the magic that Orleans is using behind the scenes. If you are curious, here is a quick peek at some of the generated code:

image

No comments: