Basic C# .NET example

Henrik Johansson

Posted on 16.11.2012 14:23
Hi, I would like to develop a plug-in for DEWESoft 7.1 b98 and I downloaded the "Basic C# .NET example" found at http://www.dewesoft.com/dewesoft7/developer-downloads. My impression was that this is a template that can be compiled, registered and put into the Addons folder of Dewesoft without additional code. But when I do this and try to select it as used in Hardware Setup a warning message pops up saying "Error Initializeing C# PluginTemplate plugin: The system cannot find the file specified". Can anyone help me solve this problem? I registered PluginTemplate.dll using RegAsm.exe and also in DEWESoft under HardWare Setup -> Plugins -> Register plugins. But when I do the latter the PluginTemplate.dll does not appear in the "DEWESoft DCOM and addons registration" that briefly appears before DEWESofts asks me to restart the program. Thanks, Henrik
Dewesoft Developer

Posted on 16.11.2012 16:31
Hi Henrik, your impression is correct, the plugin should work as you mentioned. Ok, first I would try to download example again, because it had some small bug, although I doubt that it was connected with your problem. I tried to compile and run the mentioned example on clean computer but was unable to reproduce your problem. So I would ask you for few additional informations. What kind of OS do you use, do you have user or admin rights (if you run dewesoft with admin rights you don't need to use "DEWESoft DCOM and addons registration" ), are you perhaps using DEMO licence? Did you register dll with regasm separatly or used (default) automatic registration inside Visual Studio? Best regards, David Software developer
Henrik Johansson

Posted on 19.11.2012 09:32
Hi David, Thanks for the quick reply! I have managed to get the plugin example working now. The problem was that I did not use the \codebase switch when I registered the dll with RegAsm. After I added this switch I was able to activate the plugin in DEWESoft. Some additional information to answer some of your questions and in case anyone else should experiance similar problems. I compiled the example using Visual Studio C# 2012 Express, which does not have all the fancy features of the regular Visual Studio. I specified the output path as the DEWESoft Addons folder, added a reference to DEWESoft.exe, and specified a manual Post-Build event command to register the compiled dll using RegAsm with the \codebase switch. I am running DEWESoft (using a DEMO license for the SerialCom plugin) as we are evaluating SIRIUS for possible us in our organization. So far I am quite impressed with the system, but the ability to write our own plugins is very important to us. I may be back at this forum for some more questions further on. :) Best regards, Henrik
Henrik Johansson

Posted on 19.11.2012 16:58
Hello again, I am experiancing a new problem with this plugin example. When I attempt to run it in debug mode, a StackOverflowException occurs when DEWEsoft calls the SaveSetup method in PluginIMPL.cs. When I step through the process it seems as if SaveSetup is called two times, and it is during the second time that the StackOverflowException happens. Is this a bug? Thanks, Henrik
Dewesoft Developer

Posted on 20.11.2012 13:12
Hi Henrik, it is correct that SaveSetup is called two times (1st time for blank setup and 2nd time for last setup). 1.) Did you download the latest plugin version (I mentioned in my first post that the first version had a bug, this error might be cause of this), which was put up a little after your first post here? 2.) Try deleting and adding back tlb library (Dewesoft.tlb, should be in same folder as Dewesoft.exe) If that doesn't work, please send me your project to david(dot)zobavnik(at)gmail(dot)com. Best regards, David
Login to reply to this topic. If you don't have account yet, you can signup for free account .