0

I'm trying to configure my AKKA.NET runtime environment using a HOCON configuration block in a unittest context in .NET Core 1.0. Apparently the configuration is not picked up from the App.config file.

Can anybody explain how the HOCON configuration is picked up by AKKA.NET when running in a unittest context (xunit)?

Here are some more details if the above question does not give enough information:

I'm trying to avoid the well-known warnings.

NewtonSoftJsonSerializer has been detected as a default serializer. It will be obsoleted in Akka.NET starting from version 1.5 in the favor of Wire 

I managed to get rid of this message from a Console application using AKKA.NET by the following section in App.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="akka" type="Akka.Configuration.Hocon.AkkaConfigurationSection, Akka" />
  </configSections>
  <akka>
    <hocon>
    <![CDATA[
        akka {
                actor {
                    serializers {
                      wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
                    }
                        serialization-bindings {
                        "System.Object" = wire
                        }
                    }
                }
    ]]>
    </hocon>
  </akka>
</configuration>

When I do the same in my unittest project it does not have the same effect.

I'm using xunit for unittesting. These are my dependencies:

"Akka": "1.1.1",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0",
"NSubstitute": "1.10.0",
"xunit": "2.2.0-beta2-build3300",
"dotnet-test-xunit": "2.2.0-preview2-build1029",
"Akka.TestKit": "1.1.1",
"Akka.TestKit.Xunit2": "1.1.1",
"Akka.Serialization.Wire": "1.1.1.28-beta"
Nkosi
  • 235,767
  • 35
  • 427
  • 472
Nikola Schou
  • 2,386
  • 3
  • 23
  • 47

1 Answers1

0

It turned out to be a build issue. The App.config file was copied to the build folder (something like .\bin\Debug\net46\win7-x64) and this copy sometimes is stale, meaning it is not properly updated. Deleting the bin-folder before building solved the problem.

Nikola Schou
  • 2,386
  • 3
  • 23
  • 47