gpt4 book ai didi

c# - TeamCity:GhostscriptSharp:尝试加载格式不正确的程序。 (HRESULT 异常:0x8007000B)

转载 作者:行者123 更新时间:2023-12-02 17:24:54 24 4
gpt4 key购买 nike

在 CI 上运行测试时 PDF 转换失败。我正在使用 GhostscriptsSharp 库进行转换。

我在本地运行测试时没有遇到此问题,PDF 文件已正确转换为图像。

我一直在互联网上寻找解决方案,但到目前为止我发现的所有内容都无法帮助我找到解决方案。

An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at GhostscriptSharp.GhostscriptWrapper.CreateAPIInstance(IntPtr& pinstance, IntPtr caller_handle) at GhostscriptSharp.GhostscriptWrapper.CallAPI(String[] args) at GhostscriptSharp.GhostscriptWrapper.GeneratePageThumbs(String inputPath, String outputPath, Int32 firstPage, Int32 lastPage, Int32 width, Int32 height) at Framework.Utils.FileUtils.ConvertPdfToImages(String pdfPath, String imagesPath, Int32 pageCount) in c:\TeamCity\buildAgent\work\8e7aa88e702dfaf7\Framework\Utils\FileUtils.cs:line 90 at StepDefinitions.General.Search.SearchTableSteps.ThenImagesAreCorrectInDownloadedDocumentFromSearchGrid(Table table) in c:\TeamCity\buildAgent\work\8e7aa88e702dfaf7\StepDefinitions\General\Search\SearchTableSteps.cs:line 282 at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep() at Features.Clerk.Version_2.Clerk_QuickDocFeature.ScenarioCleanup() in c:\TeamCity\buildAgent\work\8e7aa88e702dfaf7\Features\Clerk\version_2\ClerkQuickDoc.feature.cs:line 0 at Features.Clerk.Version_2.Clerk_QuickDocFeature.Clerk_DownloadRedactedDocument() in c:\TeamCity\buildAgent\work\8e7aa88e702dfaf7\Features\Clerk\version_2\ClerkQuickDoc.feature:line 28 at TechTalk.SpecRun.Framework.TaskExecutors.StaticOrInstanceMethodExecutor.ExecuteInternal(ITestThreadExecutionContext testThreadExecutionContext) in c:\TeamCity\buildAgent\work\1ace6ed01d0a43bb\TechTalk.SpecRun.Framework.Interfaces\TaskExecutors\StaticOrInstanceMethodExecutor.cs:line 40 at TechTalk.SpecRun.Framework.TestAssemblyExecutor.ExecuteTestNodeTask(TestNode testNode, ITaskExecutor task, TraceEventType eventType) in c:\TeamCity\buildAgent\work\1ace6ed01d0a43bb\TechTalk.SpecRun.Framework.Executor\TestAssemblyExecutor.cs:line 215

最佳答案

当尝试加载非 .NET 程序集(例如 native 代码 DLL)时,通常会发生“格式不正确”错误,就像它是 .NET 程序集或为不同平台编译的二进制文件(例如 32位与 64 位)。使用 ILSpy(对于托管程序集)或 Dependency Walker(对于 native DLL)等工具来验证二进制文件的属性是否与进程的属性匹配。由于看起来第 3 方程序集 (GhostscriptSharp) 正在尝试加载,因此可能需要反射(reflect)该程序集以确定错误与哪个文件有关。

关于c# - TeamCity:GhostscriptSharp:尝试加载格式不正确的程序。 (HRESULT 异常:0x8007000B),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35131158/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com