为什么我的C#winapp关闭不合理 [英] Why my C# winapp close unreasonable

查看:71
本文介绍了为什么我的C#winapp关闭不合理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中写了一个与银行PC Pos一起工作的winapp。

有时当pos throwe出错并返回应用程序时,应用程序关闭无法使用

在windows事件查看器中什么都没有创建

请帮我找到并修好它

thx



我试过的:



我在C#写了一个与银行PC Pos合作的winapp。

有时当pos throwe出错并返回到应用程序,应用程序关闭无法使用

在Windows事件查看器中没有创建

请帮我查找并修复它

thx

解决方案

我们做不到。我们无法访问yoru代码,也无法访问扔掉错误的POS设备 - 所以我们完全不知道发生了什么,更不用说你得到的错误或原因。


所以,这取决于你。

幸运的是,你有一个工具可以帮助你找到正在发生的事情:调试器。一个快速谷歌的IDE和调试器的名称应该为您提供使用它所需的信息。



在函数的第一行放置一个断点,并通过调试器运行您的代码。然后查看您的代码,并查看您的数据并找出手动应该发生的事情。然后单步执行每一行检查您预期发生的情况正是如此。如果不是,那就是当你遇到问题时,你可以回溯(或者再次运行并仔细观察)以找出原因。


如果您不能使用调试器(比如说它是实时生产设备)那么您将需要依靠onl; der方法,并开始向您的应用添加日志信息以及尝试... catch 阻止开始缩小你的应用程序中发生崩溃后可能发生的问题。



对不起,我们可以不要为你做任何事情 - 时间让你学习一门新的(非常非常有用的)技能:调试!


在try catch块中包装mainline。 br />


如何捕获C#中的所有异常&查找所有应用程序错误 [ ^ ]

I wrote a winapp in C# that work with bank PC Pos .
sometimes when pos throwe a error and returned to app , application closed unreaseanable
in windows event viewer nothing founded
please help me to findout and fix it
thx

What I have tried:

I wrote a winapp in C# that work with bank PC Pos .
sometimes when pos throwe a error and returned to app , application closed unreaseanable
in windows event viewer nothing founded
please help me to findout and fix it
thx

解决方案

We can't. We have no access to yoru code, or to the POS equipment that is "throwe a error" - so we have absolutely no idea what is going on, much less what errors you are getting, or why.

So, it's going to be up to you.
Fortunately, you have a tool available to you which will help you find out what is going on: the debugger. A quick Google for the name of your IDE and "debugger" should give you the info you need to use it.

Put a breakpoint on the first line in the function, and run your code through the debugger. Then look at your code, and at your data and work out what should happen manually. Then single step each line checking that what you expected to happen is exactly what did. When it isn't, that's when you have a problem, and you can back-track (or run it again and look more closely) to find out why.

If you can't use a debugger (it's live production equipment, say) then you will need to fall back on onl;der methods, and start adding logging information to your app along with try...catch blocks to start "Narrowing down" where in your app the problem might be occurring after the crash has occurred.

Sorry, but we can't do any of that for you - time for you to learn a new (and very, very useful) skill: debugging!


Wrap the "mainline" in a try catch block.

How to Catch All Exceptions in C# & Find All Application Errors[^]


这篇关于为什么我的C#winapp关闭不合理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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