Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class MainWindow : Window
- {
- public MainWindow()
- {
- InitializeComponent();
- }
- public static AsyncLocal<object> Test = new AsyncLocal<object>();
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- if (Test.Value == null) // same main thread here as well
- {
- Test.Value = 2; // should not get here?
- }
- }
- private void Window_Loaded(object sender, RoutedEventArgs e)
- {
- Test.Value = 1; // get here on main thread
- }
- }
Add Comment
Please, Sign In to add comment