的FolderBrowserDialog的应用程序崩溃 [英] FolderBrowserDialog crashes the application

查看:833
本文介绍了的FolderBrowserDialog的应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我打电话folderbrowserdialog.showDialog()我的应用程序崩溃。
我使用的是为我工作之前代码,因此它不能代码。

Whenever I call folderbrowserdialog.showDialog() my application crashes. I'm using the code that worked before for me, so it CAN NOT be the code.

try
{
    FolderBrowserDialog fbd = new FolderBrowserDialog();
    fbd.RootFolder = Environment.SpecialFolder.Desktop;
    if (fbd.ShowDialog() == DialogResult.OK)
    {
        //  this.Minecraft.Text = fbd.SelectedPath;
    }
}
catch
{
}

它不抛出任何错误,也不例外,那里只是弹出的小负荷圈,然后应用程序走了,我之前也是不同的.net应用程序注意到了这一点!

It does not throw any error, no exception, there just pops up the little loading circle, then the app is gone, I noticed it with a different .NET app before too!

BTW:将重新安装.NET 4的工作

btw: will reinstalling .net 4 work?

推荐答案

尝试添加这对您的应用程序(在开始?在主要()方法,最好)。查看是否exceptions.txt文件中有记录到它,当你达到冰点任何异常。

Try adding this to your application (at the start of the Main() method, preferably). See if the exceptions.txt file has any exceptions logged into it when you reach your freezing point.

        AppDomain.CurrentDomain.FirstChanceException += (sender, e) =>
        {
            if ((e == null) || (e.Exception == null))
            {
                return;
            }

            using (var sw = File.AppendText(@".\exceptions.txt")) 
            {
                sw.WriteLine(e.ExceptionObject);
            }                
        };

        AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
        {
            if ((e == null) || (e.ExceptionObject == null))
            {
                return;
            }

            using (var sw = File.AppendText(@".\exceptions.txt")) 
            {
                sw.WriteLine(e.ExceptionObject);
            }                
        };

这篇关于的FolderBrowserDialog的应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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