ironpython3 icon indicating copy to clipboard operation
ironpython3 copied to clipboard

unity error for android build : Type'Microsoft.Scripting.Hosting.ScriptHost' doenst provide a suitable public constructor or its implementation is faulty:constructor on type Microsoft.Scripting.Hosting.ScriptHost not found

Open amir1387aht opened this issue 3 years ago • 0 comments

Prerequisites

The issue tracker is used to report bugs and request new features, NOT to ask questions.

Questions should be posted in Discussions or to the users mailing list which can be accessed at https://ironpython.groups.io/g/users.

  • [y ] Are you running the latest version?
  • [y ] Are you reporting to the correct repository?
  • [y ] Did you perform a cursory search?

Description

hi, i wanna use iron python for my android unity project, i am impelented correcly iron python, like api level and ... i use this code for my project :

using UnityEngine.UI;
using System.Collections.Generic;
using UnityEngine;
using IronPython.Hosting;
using Adadshenas.EncryptionSystem.Data_ConverterClass;
using System.IO;
using System;
using Microsoft.Scripting.Hosting;

public class TestAdadshenas : MonoBehaviour
{
    public Text t;

    [Obsolete]
    private void Start()
    {
        ScriptEngine engine = null;
        try
        {
            engine = Python.CreateEngine();

        }
        catch (Exception e)
        {
            t.text = "1" + e.Message;
            return;
        }

        try
        {
            ICollection<string> searchPaths = engine.GetSearchPaths();

            searchPaths.Add(Application.streamingAssetsPath + @"\Lib\");

            engine.SetSearchPaths(searchPaths);
        }
        catch (Exception e)
        {
            t.text = "2" + e.Message;
            return;
        }

        try
        {
            dynamic scope = engine.CreateScope();

            engine.Execute(Data_Converter.dc.ValueToUrData(File.ReadAllText(
                Application.persistentDataPath + "/AdadShenas/DownloadedItems/Assets/QuestionsLogic/co-prime")), scope);

            t.text = scope.GetResulte();
        }
        catch(Exception e)
        {
            t.text = "3" + e.Message;
            return;
        }
    }

in editor, it work correcly and not give me error, but when i test in android its give me this error :

3Type'Microsoft.Scripting.Hosting.ScriptHost' doenst provide a suitable public constructor or its implementation is faulty:constructor on type Microsoft.Scripting.Hosting.ScriptHost not found

you can see '3' in error is for engine = Python.CreateEngine(); line

}

Steps to Reproduce

idk what i need to write here, i descibed error on Description

Expected behavior: support android

Actual behavior: Microsoft.Scripting dll file gets error in android, and i idk why

Versions

Unity 2021.3.15 IronPython 3 visual studio 2022

amir1387aht avatar May 06 '23 15:05 amir1387aht