UWP error UA306_A2 occuers after WPF project(.Net Framework4.8) port to .Net6
Hi,
I have a WPF Project(.Net Framework4.8), and after I port it to .Net6, the project built failed and I got below error:
UA306_A2 UWP CoreDispatcher : Windows.UI.Core.CoreDispatcher is no longer supported. Use DispatcherQueue instead. Read: https://learn.microsoft.com/en-us/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/guides/threading
The error comes from below source code:
var d = System.Windows.Threading.Dispatcher.CurrentDispatcher;
My question is that my project is not a UWP project,why did I got this error.
By the way,here are some supplements:
- I used VS2022.
- I create a new blank WPF project with VS 2017,and add the source code.
After porting to .net6,the UA306_A2 still exist,but its type is warning and the project could build successfully.
I want to know how to solve the UA306_A2 error with my project?