我正在尝试通过Xamarin UI测试启动REPL控制台,但无法在控制台上出错。
我尝试清洁和重建解决方案,检查ANDRIOD_HOME是否指向正确的位置,并验证了解决方案中是否存在xamarin.uitest.dll文件,但无法消除错误。 应用程序本身似乎没有问题,因为它正在模拟器中打开。
这是我看到的错误:
Android SDK Path: C:\Program Files (x86)\Android\android-sdk
Execution failed with exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\Sayali.Sheode\Source\Repos\Crewpad Pro\UITests\bin\Release\Xamarin.UITest.DLL' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'file:///C:\Users\Sayali.Sheode\Source\Repos\Crewpad Pro\UITests\bin\Release\Xamarin.UITest.DLL' ---> System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Mono.CSharp.DynamicLoader.LoadAssemblyFile(String assembly, Boolean isImplicitReference)
at Mono.CSharp.Evaluator.LoadAssembly(String file)
at Xamarin.UITest.Repl.Program.Main(String[] args)
Press any key to exit.
这是我的测试课:
using System.Linq;
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.UITest.Queries;
namespace UITests
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class Tests
{
IApp app;
Platform platform;
public Tests(Platform platform)
{
this.platform = platform;
}
[SetUp]
public void BeforeEachTest()
{
app = AppInitializer.StartApp(platform);
}
[Test]
public void WelcomeTextIsDisplayed()
{
app.Repl();
AppResult[] results = app.WaitForElement(c => c.Marked("Welcome"));
app.Screenshot("First Screenshot!");
Assert.IsTrue(results.Any());
}
}
}