【问题标题】:Local Build v TFSBuild issue... any ideas?Local Build v TFSBuild 问题......有什么想法吗?
【发布时间】:2012-06-14 13:25:19
【问题描述】:

我有一个公开两个服务的 WCF 项目。当我在本地构建服务时,它工作正常。当 TFS 构建创建程序集时,其中一项服务不起作用。在调用服务之前,客户端应用程序会引发“索引超出数组边界”异常。

我们将 TFS2010 用于迁移的基于 MSBuild 的项目,而不是新的工作流程。

我可以用我机器上的发布构建版本替换 TFS 构建的 DLL,并且服务开始工作。我可以将 TFS 构建版本的 DLL 放在我的机器上,我的本地服务开始失败。

我检查过的东西:

  • 所有项目都设置为构建发布 |任何 CPU
  • 两台机器都安装了VS2010 SP1
  • 反汇编这两个 DLL 显示它们包含相同的代码

有点担心:我的机器是 Windows 7 x64,构建机器是 Windows Server 2003 x86。但是,我认为任何 CPU 都意味着这在构建过程中不应该成为问题。

有没有人对调查此问题的其他方法有任何建议?

来自客户端的堆栈跟踪包括:

System.ServiceModel.FaultException 1[System.ServiceModel.ExceptionDetail]: Index was outside the bounds of the array. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is: System.IndexOutOfRangeException: Index was outside the bounds of the array. at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GetMethodInfoFromExpr(EXPRMETHODINFO methinfo) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateCall(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.VisitCALL(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Dispatch(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Visit(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.GenerateLambda(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.ExpressionTreeCallRewriter.VisitCALL(EXPRCALL pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Dispatch(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder.Semantics.ExprVisitorBase.Visit(EXPR pExpr) at Microsoft.CSharp.RuntimeBinder...

【问题讨论】:

    标签: wcf dynamic tfsbuild


    【解决方案1】:

    感谢您的建议...所有的好主意。

    我发现我的问题更加微妙。大会正在利用动态。如果您使用它来调用具有共同基类型的类的方法,其中基类型位于不同的程序集中,则存在一个鲜为人知的动态错误。动态实现查找要调用的方法的方式使用 MetadataToken 来标识该方法,但是这并不保证在整个程序集中都是唯一的,因此动态可能会混淆并尝试调用不同的方法,可能使用不同数量的参数,因此 IndexOutOfRangeException!

    已报告并修复此问题,但尚不可用:

    https://connect.microsoft.com/VisualStudio/feedback/details/691494/issue-with-getmethodinfofromexpr

    我仍然不确定为什么一个版本的 DLL 工作,而另一个没有。但是通过不使用通用基类,问题就解决了。

    【讨论】:

      【解决方案2】:

      您可以检查的几件事:

      • 您是否使用任何预编译器,例如 ngen,它会根据机器的 CPU 编译代码?
      • 您是否在使用任何第三方库?
      • 对于 64 位,Windows 2003 机器上的 IIS 上的应用程序池设置是什么?
      • 两台机器的 .net 框架的补丁级别是否相同

      【讨论】:

        【解决方案3】:

        我之前在参与过一个大型网络项目时遇到过这个问题,这真的很令人沮丧。有时,在 Visual Studio 中构建的行为与直接使用 MSBuild 构建的行为不同。 MSBuild 有 x86 和 x64 版本,它们的工作方式不同。见下文:http://blogs.msdn.com/b/msbuild/archive/2010/12/21/incorrect-solution-build-ordering-when-using-msbuild-exe.aspx

        您还可以检查构建机器上是否有 .Net Framework 和 Visual Studio 的最新版本和补丁。

        这是我为您找到的另一篇文章,其中列出了一些其他 x64 MSBuild 问题:http://blogs.msdn.com/b/visualstudio/archive/2010/05/07/building-on-cross-targeting-scenarios-and-64-bit-msbuild.aspx

        希望有帮助:)

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2023-04-07
          相关资源
          最近更新 更多