And*_*nna 10 visual-studio-2010
在过去几天,每次我编译我的解决方案(MVC 3 Web应用程序+其他几个项目)时,我在错误列表中收到此错误:
Fatal error, cannot continue: The method 'ToStringJS' is not generic (Site.css, line 1, column 1).
由于错误与css文件有关,显然我可以运行该项目.
我没有在css文件中看到错误.
即使我删除所有css文件内容,我也会收到此错误.
然而,代码突出显示消失了,而intellisense和ReSharper继续工作.
我不知道在哪里寻找这个问题(谷歌搜索没有带来任何结果,无论是Stack Exchange还是其他特定网站).这可能是一个ReSharper问题,但我有实际的手段来责怪R#,所以我想先从这里开始,然后再联系他们.
now*_*waq 10
我在Chirpy和Jurassic源代码中做了一个简短的查找,我找到了抛出异常的确切位置并导致了你描述的问题.
在侏罗纪来源中转到Jurassic\Compiler\Binders目录并打开JSBinder.cs文件.问题发生在该protected override void GenerateStub(ILGenerator generator, int argumentCount)方法中,该方法本身用于生成另一种方法... yadayadayada.这很复杂.
无论如何.这是来自该文件的代码,它负责您获得的错误:
// Line 156 (Change Set df266524321d)
// Convert to the target type.
EmitTypeConversion(generator, typeof(object), argument.Type);
if (argument.Type != typeof(ObjectInstance) && inheritsFromObjectInstance == true)
{
// EmitConversionToObjectInstance can emit null if the toType is derived from ObjectInstance.
// Therefore, if the value emitted is null it means that the "thisObject" is a type derived
// from ObjectInstance (e.g. FunctionInstance) and the value provided is a different type
// (e.g. ArrayInstance). In this case, throw an exception explaining that the function is
// not generic.
var endOfThrowLabel = generator.CreateLabel();
generator.Duplicate();
generator.BranchIfNotNull(endOfThrowLabel);
generator.LoadArgument(0);
EmitHelpers.EmitThrow(generator, "TypeError", string.Format("The method '{0}' is not generic", binderMethod.Name));
generator.DefineLabelPosition(endOfThrowLabel);
}
Run Code Online (Sandbox Code Playgroud)
如果您想深入了解一下,您可以查看实现的位置Jurassic\Library\Array\ArrayInstance.cs和Jurassic\Library\Object\ObjectInstance.cs位置public static string ToStringJS(ScriptEngine engine, object thisObject).同样在Chirpy lib中,该CSSLint.cs文件包含一些有趣的代码行(使用Jurassic的地方).
我必须承认,我不确切地知道为什么你会得到"致命错误"或者如何解决问题.这需要相当多的测试/调试工作.任何人?
无论如何,不要责怪Resharper!这是很棒的软件;-)
小智 5
问题出在CSSLint上.您可以下载源代码并尝试修复它,也可以直接禁用它.
转到工具>选项> Chirpy> CssLint
取消选中"运行CSS Lint"框.
如果您遇到与JS相同的问题,那么也要禁用JSHint
| 归档时间: |
|
| 查看次数: |
1735 次 |
| 最近记录: |