I'm writing unit tests for my silverlight classes. Everytime I use of instance of a class/control from silverlight, I usually get this exception.
System.UnauthorizedAccessException: Invalid cross-thread access.
However, with other types, the silverlight unit test project is okay.
Any idea what I'm doing wrong?
Edit:
using System.Windows;
using System.Windows.Controls;
using Microsoft.Silverlight.Testing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestMethod]
public void SomeTest()
{
var someTextBox = new TextBox(); // exception is triggered here
// assume logic
}
I think i've solved it. the issue only is found whenever I use ReSharper for running my silverlight unit tests. But if i use the built in running web app for the silverlight tests, the exception is gone
You probably need AgUnit plugin for R# to run and debug Silverlight unit tests
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.