运行“搜索所有内容”时堆损坏例外

时间:2018-05-27 08:15:43

标签: c# exception search

我担心这个问题涉及一些我不完全理解的旧框架(因此问题)。

无论如何,我正在尝试使用搜索所有内容 SDK,以便在我正在制作的小型应用程序上实现搜索功能。我设法获得他们提供并运行的旧演示文件,并且他们能够使用某个 Everything_GetResultFileName 函数返回我搜索的文件名。我将提供此功能文档的链接(其中还包含他们提供给我的示例文件)here

该程序的问题是,每当我尝试调用此特定函数时,程序将失败并退出并显示某个错误代码0xc0000374(我查找并发现它是一种损坏的堆异常) 。踢球者在他们提供的示例文件中,他们以完全相同的方式调用函数,但这次函数不会以此特定状态退出;事实上,它的工作方式与预期一致。

不确定有多少人熟悉这个概念,但我会尝试提供尽可能多的信息,以便让那些尝试回应的人更容易。

  • 我使用的是Everything64.dll文件作为方法的来源。我没有尝试过32位变体Everything32.dll。
  • 该方法在WPF应用程序(我的)中使用时失败,但在WinForms应用程序(提供的演示)中工作。

我还将提供调试日志:

** SOME OF THESE NAMES HAVE BEEN MODIFIED BUT IT SHOULDN'T DETRACT FROM THE LOG **

'Winkwonk.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: DefaultDomain): Loaded 'C:\Users\Winky\Documents\Visual Studio 2017\Projects\Winkwonk\WW\WWSoln\WW\bin\x64\Debug\Winkwonk.exe'. Symbols loaded.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\WindowsBase\v4.0_4.0.0.0__31bf3856ad364e35\WindowsBase.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_64\PresentationCore\v4.0_4.0.0.0__31bf3856ad364e35\PresentationCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xaml\v4.0_4.0.0.0__b77a5c561934e089\System.Xaml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Remote Debugger\x64\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Step into: Stepping over non-user code 'Winkwonk.App..ctor'
Step into: Stepping over non-user code 'Winkwonk.App.InitializeComponent'
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework.Aero2\v4.0_4.0.0.0__31bf3856ad364e35\PresentationFramework.Aero2.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\Users\Winky\Documents\Visual Studio 2017\Projects\Winkwonk\WW\WWSoln\WW\bin\x64\Debug\WpfAnimatedGif.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\Users\Winky\AppData\Local\Temp\VisualStudio.XamlDiagnostics.16884\Microsoft.VisualStudio.DesignTools.WpfTap.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\SMDiagnostics\v4.0_4.0.0.0__b77a5c561934e089\SMDiagnostics.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Internals\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Internals.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\UIAutomationTypes\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationTypes.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Winkwonk.exe' (CLR v4.0.30319: Winkwonk.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\UIAutomationProvider\v4.0_4.0.0.0__31bf3856ad364e35\UIAutomationProvider.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
Wink! // This is the debug message printed just before the method was called
The program '[16884] Winkwonk.exe' has exited with code -1073740940 (0xc0000374).

答案可能很明显,但我太过于忘记了。任何帮助将非常感谢。如果您有任何关于更好的搜索API与C#一起使用的建议,那么关于这些的指针也会有所帮助。如果您有任何疑问,请参阅上面提供的文档。

另一个注意事项:虽然微不足道,但我想包含一个try / catch语句不足以包含错误。

1 个答案:

答案 0 :(得分:0)

我弄清楚了问题,并回答我自己的问题,只留下残余,有一天可能会帮助其他人解决这个问题。问题是.NET 4.7.1和Everything64.dll的方法存在一些兼容性问题(这不是兼容性问题,因此.NET会因尝试在.NET 3.0之后读取/写入受保护的内存而引发错误或所以)。我将框架恢复到.NET 2.0(这可能有点极端,但它是演示程序的编程,可能也是安全的)。该程序现在按预期工作。

男孩,答案 有点显而易见。我打电话给它还是什么?