<commit_before>﻿using System;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;

namespace AssignAll
{
    [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(AssignAll_CodeFixProvider))]
    [Shared]
    public class AssignAll_CodeFixProvider : CodeFixProvider
    {
        private const string Title = "Assign all members";

        public sealed override ImmutableArray<string> FixableDiagnosticIds { get; } =
            ImmutableArray.Create(AssignAll_Analyzer.DiagnosticId);

        public sealed override FixAllProvider GetFixAllProvider()
        {
            // See https://github.com/dotnet/roslyn/blob/master/docs/analyzers/FixAllProvider.md for more information on Fix All Providers
            return WellKnownFixAllProviders.BatchFixer;
        }

        public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            SyntaxNode root =
                await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
            Diagnostic diagnostic = context.Diagnostics.First();
            TextSpan diagnosticSpan = diagnostic.Location.SourceSpan;

            // Read unassigned member names, passed on from diagnostic
            string[] unassignedMemberNames = GetUnassignedMemberNames(diagnostic);
            if (!unassignedMemberNames.Any())
                return;

            // Find the object initializer identified by the diagnostic
            ObjectCreationExpressionSyntax objectCreation =
                root.FindNode(diagnosticSpan) as ObjectCreationExpressionSyntax;
            InitializerExpressionSyntax objectInitializer = objectCreation?.Initializer;
            if (objectInitializer == null)
                return;<commit_msg>Fix Exception on Clean build<commit_after>﻿using System;
using System.Collections.Immutable;
using System.Composition;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;

namespace AssignAll
{
    [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(AssignAll_CodeFixProvider))]
    [Shared]
    public class AssignAll_CodeFixProvider : CodeFixProvider
    {
        private const string Title = "Assign all members";

        public sealed override ImmutableArray<string> FixableDiagnosticIds { get; } =
            ImmutableArray.Create(AssignAll_Analyzer.DiagnosticId);

        public sealed override FixAllProvider GetFixAllProvider()
        {
            // See https://github.com/dotnet/roslyn/blob/master/docs/analyzers/FixAllProvider.md for more information on Fix All Providers
            return WellKnownFixAllProviders.BatchFixer;
        }

        public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            SyntaxNode root =
                await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
            Diagnostic diagnostic = context.Diagnostics.FirstOrDefault();
            if (diagnostic == default)
                return;
            TextSpan diagnosticSpan = diagnostic.Location.SourceSpan;

            // Read unassigned member names, passed on from diagnostic
            string[] unassignedMemberNames = GetUnassignedMemberNames(diagnostic);
            if (!unassignedMemberNames.Any())
                return;

            // Find the object initializer identified by the diagnostic
            ObjectCreationExpressionSyntax objectCreation =
                root.FindNode(diagnosticSpan) as ObjectCreationExpressionSyntax;
            InitializerExpressionSyntax objectInitializer = objectCreation?.Initializer;
            if (objectInitializer == null)
                return;
{'fraction_non_alphanumeric': 0.06717303584144316, 'fraction_numerical': 0.0, 'mean_word_length': 3.1888667992047712, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '5510413', 'n_tokens_mistral': 1015, 'n_tokens_neox': 998, 'n_words': 237}