Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Windows窗体+;Windows 7+;System.Data.SQLite v.1.0.66.0=崩溃?_C#_Windows 7_System.data.sqlite - Fatal编程技术网

C#Windows窗体+;Windows 7+;System.Data.SQLite v.1.0.66.0=崩溃?

C#Windows窗体+;Windows 7+;System.Data.SQLite v.1.0.66.0=崩溃?,c#,windows-7,system.data.sqlite,C#,Windows 7,System.data.sqlite,嘿,伙计们,我最近在VisualStudio2008中开发的一个C#Windows窗体应用程序中遇到了一个非常奇怪的Windows 7崩溃 该应用程序在XP和Vista中都能很好地工作,但从未真正打开过;相反,“此应用程序已导致错误并已停止工作”。我使用以下源代码创建了一个虚拟应用程序: using System; using System.Windows.Forms; using System.Data.Common; using System.Data.SQLite; namespace

嘿,伙计们,我最近在VisualStudio2008中开发的一个C#Windows窗体应用程序中遇到了一个非常奇怪的Windows 7崩溃

该应用程序在XP和Vista中都能很好地工作,但从未真正打开过;相反,“此应用程序已导致错误并已停止工作”。我使用以下源代码创建了一个虚拟应用程序:

using System;
using System.Windows.Forms;
using System.Data.Common;
using System.Data.SQLite;

namespace TesteWin7
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            SQLiteConnection.CreateFile("c:\\mydatabasefile.db3");
        }
    }
}
但它还是崩溃了,所以我猜这个问题一定在我的DLL上。将源代码放在try-catch块中也是无用的,因为不会输出任何消息

有什么想法吗?我使用的是1.0.66.0版。
干杯

您是否检查了以下各项:

  • Windows事件日志(启动>“事件查看器”),查看是否记录了任何可能有用的内容
  • 运行应用程序的用户是否具有写入驱动器C:\根目录的权限
  • 特别是SQLLite导致了问题?请尝试使用下面的代码验证它是否特别是SQLLite:
手动创建文件的代码,SQLLite的操作系统:

var file = System.IO.File.CreateText("C:\TextFile.txt");
file.WriteLine("Blah");
file.Close();

我认为这与Windows7没有任何关系。我怀疑这是因为你使用的是32位的WindowsXP和WindowsVista,而不是64位的Windows7。是这样吗

解决方案是将VisualStudio项目的平台从“任意CPU”更改为“x86”。否则,sqlite DLL将不会加载到64位进程中,因为它是32位的。即使我的理论是错误的,并且您使用了32位Windows7,您仍然应该这样做,因为如果您不这样做,它仍然会在64位系统上崩溃


不要担心在64位机器上以32位运行整个进程的性能。这真的没关系。从Visual Studio 2010开始,“x86”甚至是默认值。

发布此崩溃的Windows事件日志条目。-不,没有任何日志记录。嗯,没有,用户没有,但我创建了一个新文件夹,并更新了在该文件夹中写入的代码;它不适用于SQLite,但它确实适用于文本文件,所以它一定是SQLite。