France
Asked — Edited
Resolved Resolved by DJ Sures!

I Am Trying To Connect My Bot In An Ezb Plugin

Hello

I'm a french new user and trying to connect my bot which is based on Synbot and SIML Package in an EZB Plugin

I'm using Nugget to include the Syn Package in my solution.

The plugin is working fine without reference to Syn. With a Windows forms appplication (Not a Plugin) , bot and reference to Syn are working fine.

But when I include reference to Syn Package in the plugin , I get an error :

User-inserted image

Thanks for your help

Here is my code for Plugin

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.IO; using System.Threading.Tasks; using System.Windows.Forms; using Syn.Bot;

namespace Plugin_SIML { public partial class Mainform : EZ_Builder.UCForms.FormPluginMaster { public Mainform() { InitializeComponent(); Console.SetOut(new ControlWriter(Textconsole)); } /// /// This method is called by ARC when it requests the configuration for your plugin. /// ARC will request the configuration when the control is created and when the project is saved. /// The data set in this configuration will be serialized and saved in the ARC user's project. /// Custom data may be stored in the STORAGE dictionary. /// public override EZ_Builder.Config.Sub.PluginV1 GetConfiguration() {

        return base.GetConfiguration();
    }

    /// 
    /// This method is called by ARC when a project is loaded or when the control is added to a project.
    /// Set your default data in here!
    /// The configuration from the user's project file will be set using this method.
    /// *Note: The   plugin must call Base.SetConfiguration(cf) in your override. See the example!
    /// Also note that this is a good place to ensure all required configuration data exists.
    /// In the case of a newer version of your   plugin where different configuration data may be required outside of the users configuration file, set it here.
    /// 
    public override void SetConfiguration(EZ_Builder.Config.Sub.PluginV1 cf)
    {

        base.SetConfiguration(cf);
    }

    /// 
    /// This method is called by ARC when another control sends a command to this control using the  EZ-Script  ControlCommand() function.
    /// The available  ControlCommand() functions for this control should be returned in the GetSupportedControlCommandsMethodsForSlave() override.
    /// 
    public override void SendCommand(string windowCommand, params string[] values)
    {

        base.SendCommand(windowCommand, values);
    }

    /// 
    /// This method is called by ARC for the  Cheat Sheet to receive all available  ControlCommand() syntax for this control.
    /// When the  ControlCommand() is called for this function, see the SendCommand() override.
    /// 
    public override object[] GetSupportedControlCommands()
    {

        return base.GetSupportedControlCommands();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        Console.WriteLine("Test Create Bot");        
        var simlBot = new Syn.Bot.Siml.SimlBot();
    }

    private void button2_Click(object sender, EventArgs e)
    {
        Console.WriteLine("Stop");
    }

    private void Textconsole_TextChanged(object sender, EventArgs e)
    {

    }
}
public class ControlWriter : TextWriter
{
    private Control textbox;
    public ControlWriter(Control textbox)
    {
        this.textbox = textbox;
    }

    public override void Write(char value)
    {
        textbox.Text += value;
    }

    public override void Write(string value)
    {
        textbox.Text += value;
    }

    public override Encoding Encoding
    {
        get { return Encoding.ASCII; }
    }
}

}


ARC Pro

Upgrade to ARC Pro

Elevate your robot's capabilities to the next level with Synthiam ARC Pro, unlocking a world of possibilities in robot programming.

PRO
Synthiam
#1  

As the error says, the DLL is not in the plugin folder. You can't use a DLL that cannot be physically located. Have your project copy the DLL to the plugin folder.

The error reads that the DLL must be copied to the plugin folder. Right click on your DLL in the project reference and select it to be copied with build. This is the same as you have had to do with the plugin.xml.

There's information on this topic in the plugin tutorial: https://synthiam.com/Tutorials/UserTutorials/146/20

Also, as preemptive advice for performance, I notice the ControlWriter is += to a textbox instead of Appending. And that's an incredibly slow and memory hungry way to append information to a text box. I would recommend using an ARC Invoker as per the compliance here: https://synthiam.com/Tutorials/UserTutorials/146/21

Using the Invoker would ensure the appended text is performed on the correct thread and not using valuable GUI thread CPU time. It also uses much less memory by not += memory copying the contents for appending.

Lastly, please is the [ code ] and [ /code ] formatting when pasting code so it can be readable.

#2  

Many thanks DJ

But as you can see below the DLL is copied in the plugin Folder

Thanks for your help

User-inserted image

PRO
Synthiam
#3  

It's very strange - the syn DLL is looking for system.dll in the plugin folder.

I cannot seem to reproduce the issue on my machine. I will run a few more tests and get back to you.

#4  

Thanks DJ

In a normal Windows Form Application , all is working fine. Ask me if you need more détails on my configuration

PRO
Synthiam
#5  

I'm still looking into this

PRO
Synthiam
#6  

I'm struggling to understand why JINT.DLL is programmatically requesting to load the System.dll assembly... that's what is causing the message, however i cannot seem to track down why or how it is happening.

PRO
USA
#7  

@DJ,

I had the same problem sometime ago: ARC + plugin + Component

After struggling for a few days, i moved the code to an external App to keep going. Later i developed a plugin framework to test the dynamic load like you do in ARC and i couldn't reproduce the problem. So far only happens with ARC.

My solution to help troubleshooting:

AssemblyLoadTest.zip

  1. Plugin your smtp client (I added a button to do the test)

  2. Component Simple class with a Regex method. Note: i had problems with another class but i can't remember.

User-inserted image

PRO
Synthiam
#8  

It appears to be an issue when loading portable libraries. I added a second library that is loaded to your example, which works. Try this: AssemblyLoadTest-NoCrash.zip

PRO
USA
#9  

Yes it works.

Unfortunately PCL assemblies are becoming more frequent, some of them don't offer a non PCL version.

DJ did you tried the Plugin+PCL issue in debug Mode (ARC code open in the visual studio) ?

If you want to dig the issue, you can try to call the plugin early as possible in your ARC code to confirm if the problem surfaces immediately or after loading other assemblies.

PRO
Synthiam
#10  

Figured it out. I'll release an update this evening. Thanks for your help!

PRO
Synthiam
#11  

Can you close this assistance thread? The latest ARC resolves this issue.