最初分发C#.NET应用程序时遇到问题 [英] Trouble with initial distribution of C# .NET application

查看:42
本文介绍了最初分发C#.NET应用程序时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用WinForms UI工具包在C#.NET中编写了一个应用程序.我正在尝试提供Windows可执行文件,但到目前为止,它们只对我有用.

I've written an application in C# .NET with the WinForms UI toolkit. I'm attempting to provide Windows executables, but so far they simply don't work for anyone but me.

我正在通过在Visual Studio 2017中构建EXE和DLL,将它们复制到一个位置,然后将其放入.zip存档中来创建发行包.我不是在做花哨的一键式发布工作.

I'm creating the release packages by building the EXE and DLLs in Visual Studio 2017, copying them into one place, and putting that into a .zip archive. I'm not doing the fancy one-click publishing stuff.

该项目在github上可用( https://github.com/fadden/6502bench ).第一个尝试在Win7上获得< program>已停止工作"的人(参见问题).第二个人正在使用Win10 Pro,并从事件日志中提取了一些详细信息,表明它在系统DLL中崩溃(

The project is available on github (https://github.com/fadden/6502bench). The first person to try it got "<program> has stopped working" on Win7 (see issue). The second person was using Win10 Pro, and extracted some details from the event log that show it crashing in a system DLL (see issue). Both of them have the latest .NET framework installed.

我还没有在Unity之外使用C#.NET,所以我有点不了解.我完全有可能跳过了显而易见的"步骤,或者做错了事.

I haven't worked with C# .NET outside Unity, so I'm a bit out of my depth. It's entirely possible I've skipped an "obvious" step, or am doing things wrong.

更新:回答一些评论:

  • 它是纯C#,没有本机代码或不安全的代码
  • 两个报告问题的人都确认安装了最新的.NET框架(4.7.2)
  • 该程序似乎根本没有启动,所以我不确定就本地路径而言,该应用程序可能在做错什么
  • 具体的错误,包括屏幕截图和日志消息,包含在上面链接的问题中
  • 有关VS解决方案和项目的完整源代码位于github

我从评论中得到的感觉是我在做的事情根本上不是错的,所以细节上有些恶魔.

The sense I'm getting from the comments is that what I'm doing isn't fundamentally wrong, so there's some devil in the details.

推荐答案

我下载了源代码并进行了调试.

I downloaded the source, and debugged.

在以下两行代码中,我收到了 StackOverFlowException .

I received a StackOverFlowException on the following 2 lines of code.

行3545 : symbolListView.Columns [2] .Width = lastWidth;

行3719 : referencesListView.Columns [2] .Width = lastWidth;

这是怎么回事,您正在处理 ListView 组件上的 ColumnWidthChanged 事件,并修改列宽.此修改会再次触发该事件,这将导致无限循环,并随后引发 StackOverflowException .

What is going on is you are handling the ColumnWidthChanged event on ListView components, and modifying the column width. This modification fires the event again, which is causing an infinite loop, and a subsequent StackOverflowException.

但是为什么呢?我将摇摆一个答案.您可能已经对一些与显示器的DPI和分辨率相匹配的值进行了硬编码.当 ListView 在您的计算机上实例化时,它不必使用来重绘"该列,也不会触发该事件,但是对于其他没有相同分辨率和DPI的人,事件触发并导致循环.我可能错了,但听起来对我来说似乎很合理.

But why? I'll take a swing at an answer. You may have hard coded some values that line up with the DPI and resolution of your monitor. When the ListView instantiates on your machine, it doesn't have to 'redraw' the column with and does not fire the event, but for anyone else that doesn't have the same resolution and DPI, the event fires and causes the loop. I could be wrong, but sounds plausible to me.

这篇关于最初分发C#.NET应用程序时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆