【发布时间】:2016-02-17 17:08:05
【问题描述】:
我有一个包含多个项目的 WPF 企业级解决方案。代码在 VS 2013 中构建良好,在 VS 2015 中代码无法构建。
我试过了:
- 删除受影响的项目并调整代码以观察它就是这个项目。是的。
- 我尝试使用 NuGet 管理器删除“PostSharp”、“PostSharp.Patterns.Common”、“PostSharp.Patterns.Model”的 PostSharp 引用;重建,重新启动 VS,从 Nuget 获取最新信息。同样的例外。
- 我尝试升级所有其他项目。同样的故事。
在解决方案中,我还提到了 MS 的“Prism”和“Unity”。问题是我什至不知道这发生在“哪里”,只是因为堆栈跟踪错误只是提到了项目而不是特定的类或位置,而不是对“PostSharp”命名空间的引用。是这样的:
'Severity Code Description Project File Line Suppression State
Error An unexpected exception occurred when executing user code: System.InvalidCastException: Unable to cast object of type 'System.Reflection.RuntimeConstructorInfo' to type 'System.Reflection.MethodInfo'.
at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.PropertiesDependenciesAnalyzer.MethodAnalyzer.TryGetDependsOn(IMethodCallExpression expression, List`1& invocationPaths, List`1& messages)
at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.PropertiesDependenciesAnalyzer.MethodAnalyzer.VisitMethodCallExpression(IMethodCallExpression expression)
at PostSharp.Reflection.Syntax.SyntaxTreeVisitor.VisitSyntaxElement(ISyntaxElement syntaxElement)
at PostSharp.Reflection.Syntax.SyntaxTreeVisitor.VisitStatementExpression(IStatementExpression statementExpression)
at PostSharp.Reflection.Syntax.SyntaxTreeVisitor.VisitSyntaxElement(ISyntaxElement syntaxElement)
at PostSharp.Reflection.Syntax.SyntaxTreeVisitor.VisitBlockExpression(IBlockExpression instructionBlock)
at PostSharp.Reflection.Syntax.SyntaxTreeVisitor.VisitSyntaxElement(ISyntaxElement syntaxElement)
at PostSharp.Reflection.Syntax.SyntaxTreeVisitor.VisitBlockExpression(IBlockExpression instructionBlock)
at PostSharp.Reflection.Syntax.SyntaxTreeVisitor.VisitMethodBody(ISyntaxMethodBody methodBody)
at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.PropertiesDependenciesAnalyzer.MethodAnalyzer.AnalyzeMethodRecursive(MethodBase method)
at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.PropertiesDependenciesAnalyzer.MethodAnalyzer.AnalyzeProperty(Type type, PropertyInfo propertyInfo, ExplicitDependencyMap currentTypeExplicitDependencyMap)
at PostSharp.Patterns.Model.NotifyPropertyChanged.DependencyAnalysis.PropertiesDependenciesAnalyzer.AnalyzeType(Type type)
at PostSharp.Patterns.Model.NotifyPropertyChangedAttribute.CompileTimeInitialize(Type type, AspectInfo aspectInfo)
at PostSharp.Sdk.AspectWeaver.AspectWeavers.TypeLevelAspectWeaverInstance.^RDzfO2to.^XTF+fjOj()
at PostSharp.Sdk.Utilities.ExceptionHelper.ExecuteUserCode(MessageLocation messageLocation, Action userCode, Type[] acceptableExceptions). Namespace.Project D:\TFS\SourceCodeLocation\POSTSHARP
【问题讨论】:
标签: visual-studio-2013 visual-studio-2015 postsharp