无法启动应用程序,KernelBase.dll 错误
Unable to start application, KernelBase.dll fault
我在 Windows 7/8 x64 上 运行 应用程序有问题,但我可以在 Windows 10 x64 上启动。在 Visual Studio 中,平台目标设置为 Any CPU 但它对我没有帮助。我在我的开发机器上构建的应用程序 OS: Windows 10 x64
Windows 日志
应用程序错误:
Faulting application name: Training charts.exe, version: 0.4.3.18, time stamp: 0x55f2b40f
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18869, time stamp: 0x556366fd
Exception code: 0xe0434352
Fault offset: 0x000000000000b3dd
Faulting process id: 0x5f0
Faulting application start time: 0x01d0ec8a5e92040f
Faulting application path: C:\Program Files (x86)\Training Charts\Training charts.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: 9ccd617f-587d-11e5-ae3d-000c29c8cb67
.NET 运行时:
Application: Training charts.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
Stack:
at MS.Internal.Resources.ResourceManagerWrapper.GetStream(System.String)
at MS.Internal.AppModel.ResourcePart.EnsureResourceLocationSet()
at MS.Internal.AppModel.ResourcePart.GetContentTypeCore()
at System.IO.Packaging.PackagePart.get_ContentType()
at System.Windows.Application.LoadComponent(System.Object, System.Uri)
at Training_charts.App.InitializeComponent()
at Training_charts.App.Main()
您知道如何解决这个问题吗?应用需要 .NET 4.5
就我而言,AsseblyInfo.cs 中存在问题,我不得不删除中性语言行。
就我而言,当我在更新 .NET Framework 版本后部署我的应用程序时,我忘记部署配置文件。因此,正在使用指向错误运行时的旧配置文件。
具体这部分:
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
在我的例子中,EventLog 和 Linq 的组合在一些 Windows 10 个系统上导致了这个错误:
KERNELBASE.dll, Version: 10.0.17134.319, Timestamp: 0x5ea0e53d
Exception code: 0xc000041d
Error offset: 0x001117d2
ID of erronous process: 0x175c
Path to erronous modul: C:\WINDOWS\System32\KERNELBASE.dll
无论如何,使用 Linq 查询整个事件日志记录以获取特定 InstanceId(以前称为 EventId Z Id)的最新最后一个记录是非常低效的,
我更改了代码以使用 EventLogQuery
代替:
string queryString = "*[System[Provider[@Name='MyApp'] and (EventID=1 or EventID=2)]]";
EventLogQuery eventsQuery = new EventLogQuery("Application", PathType.LogName, queryString);
eventsQuery.ReverseDirection = true;
eventsQuery.TolerateQueryErrors = true;
try
{
EventLogReader logReader = new EventLogReader(eventsQuery);
EventRecord lastLogEntry = logReader.ReadEvent();
}
catch (EventLogNotFoundException)
{
Console.WriteLine("Error while reading the event logs");
return;
}
我在 Windows 7/8 x64 上 运行 应用程序有问题,但我可以在 Windows 10 x64 上启动。在 Visual Studio 中,平台目标设置为 Any CPU 但它对我没有帮助。我在我的开发机器上构建的应用程序 OS: Windows 10 x64
Windows 日志
应用程序错误:
Faulting application name: Training charts.exe, version: 0.4.3.18, time stamp: 0x55f2b40f
Faulting module name: KERNELBASE.dll, version: 6.1.7601.18869, time stamp: 0x556366fd
Exception code: 0xe0434352
Fault offset: 0x000000000000b3dd
Faulting process id: 0x5f0
Faulting application start time: 0x01d0ec8a5e92040f
Faulting application path: C:\Program Files (x86)\Training Charts\Training charts.exe
Faulting module path: C:\Windows\system32\KERNELBASE.dll
Report Id: 9ccd617f-587d-11e5-ae3d-000c29c8cb67
.NET 运行时:
Application: Training charts.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
Stack:
at MS.Internal.Resources.ResourceManagerWrapper.GetStream(System.String)
at MS.Internal.AppModel.ResourcePart.EnsureResourceLocationSet()
at MS.Internal.AppModel.ResourcePart.GetContentTypeCore()
at System.IO.Packaging.PackagePart.get_ContentType()
at System.Windows.Application.LoadComponent(System.Object, System.Uri)
at Training_charts.App.InitializeComponent()
at Training_charts.App.Main()
您知道如何解决这个问题吗?应用需要 .NET 4.5
就我而言,AsseblyInfo.cs 中存在问题,我不得不删除中性语言行。
就我而言,当我在更新 .NET Framework 版本后部署我的应用程序时,我忘记部署配置文件。因此,正在使用指向错误运行时的旧配置文件。 具体这部分:
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>
在我的例子中,EventLog 和 Linq 的组合在一些 Windows 10 个系统上导致了这个错误:
KERNELBASE.dll, Version: 10.0.17134.319, Timestamp: 0x5ea0e53d
Exception code: 0xc000041d
Error offset: 0x001117d2
ID of erronous process: 0x175c
Path to erronous modul: C:\WINDOWS\System32\KERNELBASE.dll
无论如何,使用 Linq 查询整个事件日志记录以获取特定 InstanceId(以前称为 EventId Z Id)的最新最后一个记录是非常低效的,
我更改了代码以使用 EventLogQuery
代替:
string queryString = "*[System[Provider[@Name='MyApp'] and (EventID=1 or EventID=2)]]";
EventLogQuery eventsQuery = new EventLogQuery("Application", PathType.LogName, queryString);
eventsQuery.ReverseDirection = true;
eventsQuery.TolerateQueryErrors = true;
try
{
EventLogReader logReader = new EventLogReader(eventsQuery);
EventRecord lastLogEntry = logReader.ReadEvent();
}
catch (EventLogNotFoundException)
{
Console.WriteLine("Error while reading the event logs");
return;
}