c#-Visual Studio报告了罗斯林分析仪中缺少的方法,但肯定存在
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c#-Visual Studio报告了罗斯林分析仪中缺少的方法,但肯定存在,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1717字,纯文字阅读大概需要3分钟。
内容图文
我正在尝试使用此分析器(我写了)
https://www.nuget.org/packages/Weingartner.Json.Migration.Analyzer/
https://github.com/Weingartner/Migrations.Json.Net
我将其应用于此源文件
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Weingartner.Json.Migration;
namespace testjson
{
[DataContract]
[Migratable("")]
public class Class1
{
[DataMember]
public int foo { get; set; }
}
}
并且我在输出中看到以下警告.
1>CSC : warning CS8032: An instance of analyzer
Weingartner.Json.Migration.Roslyn.MigrationHashAnalyzer cannot be created from
C:\Users\phelan\workspace\testjson\packages\Weingartner.Json.Migration.Analyzer.1.0.4\analyzers\dotnet\cs\Weingartner.Json.Migration.Roslyn.dll
: Method ‘get_SupportedDiagnostics’ in type
‘Weingartner.Json.Migration.Roslyn.MigrationHashAnalyzer’ from
assembly ‘Weingartner.Json.Migration.Roslyn, Version=1.0.6246.21734,
Culture=neutral, PublicKeyToken=null’ does not have an
implementation..
这很奇怪,因为如果我用JustDecompile破解DLL,我会看到
[DiagnosticAnalyzer("C#", new string[] { })]
public class MigrationHashAnalyzer : DiagnosticAnalyzer
{
<snip>
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics
{
get
{
return ImmutableArray.Create<DiagnosticDescriptor>(MigrationHashAnalyzer.Rule);
}
}
<snip>
}
这是我期望的,因为分析器的源可以编译.如果该方法确实缺失,则将无法编译.
为什么VS会报告一个真正丢失的方法?
解决方法:
Visual Studio对于它使用的库的版本非常讲究. VS本身使用System.Collections.Immutable包的version 1.1.36.由于您的分析仪使用其他版本,因此运行时无法找到该方法,并假定尚未实现.
参考号:https://johnkoerner.com/code-analysis/creating-a-code-analyzer-using-f/#comment-3073977270
内容总结
以上是互联网集市为您收集整理的c#-Visual Studio报告了罗斯林分析仪中缺少的方法,但肯定存在全部内容,希望文章能够帮你解决c#-Visual Studio报告了罗斯林分析仪中缺少的方法,但肯定存在所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。