<commit_before>﻿using System;
using System.Threading;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.UI.Core;

namespace Caliburn.Light
{
    /// <summary>
    /// A UI execution context based on <see cref="CoreDispatcher"/>.
    /// </summary>
    public sealed class DispatcherUIContext : IUIContext
    {
        private readonly CoreDispatcher _dispatcher;
        private TaskScheduler _taskScheduler;

        /// <summary>
        /// Initializes the <see cref="UIContext"/>.
        /// </summary>
        public DispatcherUIContext(CoreDispatcher dispatcher)
        {
            if (dispatcher is null)
                throw new ArgumentNullException(nameof(dispatcher));

            _dispatcher = dispatcher;
        }

        /// <summary>
        /// Determines whether the calling thread is the thread associated with the UI context. 
        /// </summary>
        public bool CheckAccess()
        {
            return _dispatcher.HasThreadAccess;
        }

        /// <summary>
        /// Verifies that the calling thread has access to the UI context.
        /// </summary>
        public void VerifyAccess()
        {
            if (!CheckAccess())
                throw new InvalidOperationException("The calling thread does not have access to the UI context.");
        }

        private static async void Observe(IAsyncAction asyncAction)
        {<commit_msg>Fix warning<commit_after>﻿using System;
using System.Threading;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.UI.Core;

namespace Caliburn.Light
{
    /// <summary>
    /// A UI execution context based on <see cref="CoreDispatcher"/>.
    /// </summary>
    public sealed class DispatcherUIContext : IUIContext
    {
        private readonly CoreDispatcher _dispatcher;
        private TaskScheduler _taskScheduler;

        /// <summary>
        /// Initializes this <see cref="DispatcherUIContext"/>.
        /// </summary>
        public DispatcherUIContext(CoreDispatcher dispatcher)
        {
            if (dispatcher is null)
                throw new ArgumentNullException(nameof(dispatcher));

            _dispatcher = dispatcher;
        }

        /// <summary>
        /// Determines whether the calling thread is the thread associated with the UI context. 
        /// </summary>
        public bool CheckAccess()
        {
            return _dispatcher.HasThreadAccess;
        }

        /// <summary>
        /// Verifies that the calling thread has access to the UI context.
        /// </summary>
        public void VerifyAccess()
        {
            if (!CheckAccess())
                throw new InvalidOperationException("The calling thread does not have access to the UI context.");
        }

        private static async void Observe(IAsyncAction asyncAction)
        {
{'fraction_non_alphanumeric': 0.09171075837742504, 'fraction_numerical': 0.0, 'mean_word_length': 2.0170212765957447, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4814616', 'n_tokens_mistral': 698, 'n_tokens_neox': 672, 'n_words': 219}