运行使用FSharp.Data的单元测试时,缺少MissingMethodException [英] MissingMethodException when running a unit test that uses FSharp.Data
本文介绍了运行使用FSharp.Data的单元测试时,缺少MissingMethodException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个用普通的F#库编写的NUnit单元测试,但目标是可移植类库中的F#代码.
I have a NUnit unit test that is written in a normal F# library but targets F# code in a Portable Class Library.
运行此测试(在Visual Studio 2013中)时,出现以下异常:
When I run this test (in Visual Studio 2013), I get the following exception:
Result Message: System.MissingMethodException : Method not found:
'Microsoft.FSharp.Control.FSharpAsync`1<System.IO.TextReader> FSharp.Data.Runtime.IO.asyncReadTextAtRuntime(System.Boolean, System.String, System.String, System.String, System.String)'.
这是我在可移植类库中的app.config中包含的内容:
This is what I have in my app.config in the Portable Class Library:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.1.0" newVersion="3.3.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
这是我正常的F#库的app.config中包含的内容:
This is what I have in the app.config of my normal F# library:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="FSharp.Core" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.1.0" newVersion="4.3.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.13283" newVersion="2.6.3.13283" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
推荐答案
显然,FSharp.Data不支持使用配置文件7的PCL库.将我的PCL项目配置文件更改为47后,一切正常.
Apparently, FSharp.Data does not support PCL libraries using profile 7. After changing my PCL project profile to 47 everything works as expected.
这篇关于运行使用FSharp.Data的单元测试时,缺少MissingMethodException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文