无法启动应用程序,KernelBase.dll错误

时间:2015-09-11 12:16:19

标签: c# windows kernel

我在Windows 7/8 x64上运行应用程序时遇到问题,但我可以在Windows 10 x64上启动。在Visual Studio平台中,目标设置为任何CPU,但它没有帮助我。应用程序我在我的开发机器操作系统上构建: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

3 个答案:

答案 0 :(得分:1)

就我而言,在更新.NET框架版本后部署应用程序时,我忘记部署配置文件。因此使用旧的配置文件指向错误的运行时。 特别是这部分:

<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup>

答案 1 :(得分:1)

在我的情况下,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;
}

答案 2 :(得分:0)

就我而言,AsseblyInfo.cs中存在问题我不得不删除中性语言行。