Pie*_*son 2 wcf dynamic tfsbuild tfs2010
我有一个公开两个服务的WCF项目.当我在本地构建服务时,它工作正常.当TFS Build创建程序集时,其中一个服务不起作用.在调用服务之前,客户端应用程序抛出"索引超出数组范围"异常.
我们将TFS2010用于基于迁移的基于MSBuild的项目而不是新的工作流程过程.
我可以从我的机器上用版本构建版本替换TFS构建的DLL,并且服务开始工作.我可以将TFS内置版本的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...
感谢您的建议......所有伟大的想法.
我发现我的问题更加微妙.该组件正在利用动力学.如果您使用它来调用具有公共基类型的类的方法,那么动态有一个鲜为人知的错误,其中基类型在不同的程序集中.动态实现查找要调用的方法的方式使用MetadataToken来识别方法,但是这并不保证在组件中是唯一的,因此动态可能会混淆并且可能尝试调用不同的方法,可能具有不同的数量参数,因此IndexOutOfRangeException!
这已被报告并修复但尚未提供:
https://connect.microsoft.com/VisualStudio/feedback/details/691494/issue-with-getmethodinfofromexpr
我仍然不确定为什么一个版本的DLL工作而另一个版本没有.但是由于没有使用通用的基类,问题就消失了.