调试类库插件时遇到问题

发布于 2024-09-03 23:52:07 字数 379 浏览 6 评论 0原文

我有一个 Windows 窗体应用程序,我试图在其中使用插件(类库)。在代码中,我让它从 dll 文件加载程序集,这意味着我无法调试。此外,我还没有找到如何编译该库,因此我不得不使用调试过的 dll 版本进行测试。我遇到了一个错误,在该错误中,我创建了一个新对象并通过接口将该数据发送到插件,试图从插件中检索空白的石板组框。然而,我没有将参数作为新对象读取,而是设法单步执行代码一次(不要问我怎么做,我不知道而且我无法重复它),而且代码似乎正在注册参数为“无”,这就是为什么我在主程序中收到空引用错误的原因。

有没有更好的方法来调试这个机制,找出问题出在哪里?关于问题可能是什么的任何想法。当我阅读时,这似乎有点模糊,我不知道如何描述它,但如果有人愿意了解正在发生的事情,我愿意主持一次立即连接会议,并且我不会让自己被理解很好。

I have a windows form application in which I'm attempting to utilize a plugin (class library). In the code I have it load the assembly from a dll file, which means I have not been able to debug. Furthermore I have not found out how to compile the library so I've had to use the debuged dll version for testing. I've run into a bug in which I create a new object and send that data through an interface to the plugin in an attempt to retrieve a blank slate group box from the plugin. However instead of reading the parameter as a new object i managed to step through the code once (don't ask me how, I don't know and I haven't been able to repeat it) and it appeared that the code was registering the parameter as "nothing" thus why I received a null reference error in the main program.

Is there a better way to debug this mechanism and find out where the problem is? Any ideas on what the problem could be. As I read over this is seems somewhat vague and I'm not sure how to describe it, but I'm willing to host a connect now meeting if anyone is willing to look at what is going on and I'm not making myself understood very well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月苍老的讽刺 2024-09-10 23:52:07

我不确定我是否完全遵循您正在做的事情,但我通常发现调试类库的最佳方法是在类库的解决方案中添加一个新项目,可以是 WinForms 项目,也可以是 Console 项目,然后我将此新项目设置为启动项目,并添加对类库项目的引用(通过“添加引用”对话框中的“项目”选项卡)。

然后,您将能够从其他项目调用类库中的方法,并且可以在任何地方放置断点以轻松查看实际情况。

I'm not sure if I follow exactly what you're doing but I usually find that the best way to debug a class library is by in the solution for the class library I add a new project, either a WinForms one or a Console one, I then set this new project as the start up project and add a reference to the Class Library project (via the Project tab in the Add Reference dialog).

You'll then be able to call the methods in the class library from the other project and you can put breakpoints anywhere to see what's really going on easily.

痴者 2024-09-10 23:52:07

好的,所以问题是,任何时候你编辑类库,你都必须编译(我知道的唯一方法是调试,我找不到编译按钮,发布按钮不起作用,构建也不起作用似乎制作了一个dll)。但无论如何你必须编译、传输文件,这样你才能阅读最新的文件。如果您在运行时编辑代码,它不会更新正在使用的 dll...这是我的问题。

Ok, so the problem was that any time you edit the class library you have to compile (and the only way I know how is debugging, I can't find a compile button and the publish button doesn't work and building doesn't appear to make a dll). But anyways you have to compile, transfer the file so you are reading the most recent one. If you edit the code during runtime it does NOT update the dll in use...which was my problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文