gpt4 book ai didi

c# 异常抛出在(不在)构造函数中

转载 作者:行者123 更新时间:2023-11-30 19:19:49 26 4
gpt4 key购买 nike

在构造函数调用中(而不是在调用中)抛出异常:

controller = new Controller(classInstance);   // Won't let me step in, exception thrown immediately.

异常描述为:

System.BadImageFormatException: Could not load file or assembly 'ClassLib, Version=1.0.4314.17265, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

classInstace 不为空,我无法进入构造函数。我以前从未经历过这种情况。知道这可能是什么吗?

谢谢!

最佳答案

尝试使用 Fusion Log Viewer (fuslogvw.exe) 查看哪个程序集与 ClassLib 匹配。正如 Jon Skeet 所说,它可能是文件损坏、32 位与 64 位问题或奇怪的运行时不匹配。

关于c# 异常抛出在(不在)构造函数中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7878262/

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