Open
Description
openedon Feb 28, 2019
System information
-
OS version/distro: Version Windows 10.0.17763
-
.NET Version (eg., dotnet --info): .Net 4.6.2
Issue Error when using OnnxTransformer in two AppDomains
- What did you do?
I have a (production) application with two AppDomains.
I'm trying to run OnnxTransformer in my code within the AppDomain, and get an error when second AppDomain is invoked.
The error is easily reproduced in a Console App with two AppDomains (below).
- What happened?
Error is thrown.
Microsoft.ML.OnnxRuntime.OnnxRuntimeException: '[ErrorCode:RuntimeException] Only one instance of LoggingManager created with InstanceType::Default can exist at any point in time
Source code / logs
Here is simple code to reproduce the error:
namespace MlNetAppDomainErrorRepro
{
using System;
using Microsoft.ML;
using Microsoft.ML.Transforms;
class Program
{
public static void CreateOnnxTransformer()
{
MLContext context = new MLContext();
OnnxTransformer t = new OnnxTransformer(context, @"PathToYourModel.onnx");
}
static void Main(string[] args)
{
CreateOnnxTransformer();
AppDomain secondAppDomain = AppDomain.CreateDomain("SecondAppDomain");
secondAppDomain.DoCallBack(CreateOnnxTransformer); // error here
Console.ReadLine();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment