작업 (및 작업 ::) 내에서 XAML 컨트롤에 액세스하려고하면 Metro XAML 응용 프로그램이 항상 예외로 중지됩니다. 동일한 코드는 작업 외부에서 문제없이 작동합니다. 나는 어떤 대답도 찾지 못했다. 나는 무엇을 놓쳤는가?작업 내에서 XAML 컨트롤에 예외 액세스
VS11 디버거 보고서 : 동시성 :: unobserved_task_exception
예외 : 응용 프로그램이 다른 스레드 정렬 화 된 인터페이스를했다.
많은 도움을 주셔서 감사합니다. 우리가 task_continuation_context 추가하는 경우
void MyClass::MyMemberFunction()
{
xamlStoryboard->Stop(); // ok
xamlImage->Source = ref new BitmapImage(); // ok
task<void> atask([this]()
{
xamlStoryboard->Stop(); // exception!
xamlImage->Source = ref new BitmapImage(); //exception!
});
atask.then([this]()
{
xamlStoryboard->Stop(); // exception!
xamlImage->Source = ref new BitmapImage(); //exception!
});
}
atask.then() 연속 코드는 예외없이 실행 :: 두 번째 매개 변수로 use_current() 를 :
atask.then([this]()
{
xamlStoryboard->Stop(); // now ok!
xamlImage->Source = ref new BitmapImage(); // now ok!
}, task_continuation_context::use_current());
어떤 예외가 있습니까? – animaonline
질문이 업데이트되었습니다 - VS11 디버거가보고합니다 : Concurrency :: unobserved_task_exception – Telestes
그다지 말하지 않았지만 내부 예외가 있습니까? – animaonline