dotnet/roslyn

VisualBasicSuppressionCodeFixProvider crashed with ArgumentOutOfRangeException

Open

#11,173 opened on May 9, 2016

View on GitHub
 (2 comments) (0 reactions) (0 assignees)C# (20,414 stars) (4,257 forks)batch import
Area-AnalyzersBughelp wanted

Description

Right clicked on <see cref="TypeDescriptionProvider" />, and chose Quick Actions and Refactorings.


Namespace Microsoft.VisualStudio.ComponentModel

    ''' <summary>
    '''     A <see cref="TypeDescriptionProvider"/> that allows you swap out an abstract class with a concrete 
    '''     implementation, so that derived types can be opened And designed in the editor.
    ''' </summary>
    internal Class AbstractControlTypeDescriptionProvider<TAbstract, TDerived> : TypeDescriptionProvider
    {
        // Based on Brian Pepin's post: http://www.pocketsilicon.com/post/Using-Visual-Studio-Whidbey-to-Design-Abstract-Forms

        Public AbstractControlTypeDescriptionProvider()
              base(TypeDescriptor.GetProvider(TypeOf(TAbstract)))
        {
        }

        Public override Type GetReflectionType(Type objectType, Object instance)
        {
            // If the designer Is asking for the abstract control,
            // return the "concrete" version of it instead
            If (objectType == TypeOf (TAbstract))
        Return TypeOf (TDerived);

            Return base.GetReflectionType(objectType, instance);
        }

        Public override Object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, Object[] args)
        {
            // If the designer Is asking to create the abstract 
            // control, instantiate the "concrete" version of it instead
            If (objectType == TypeOf (TAbstract))
                objectType = TypeOf(TDerived);

            Return base.CreateInstance(provider, objectType, argTypes, args);
        }
    }



End Namespace

Specified argument was out of the range of valid values. Parameter name: length at Microsoft.CodeAnalysis.Text.TextSpan..ctor(Int32 start, Int32 length) at
Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider.PragmaHelpers.NormalizeTriviaOnTokens(AbstractSuppressionCodeFixProvider fixer, Document& document, SuppressionTargetInfo& suppressionTargetInfo) 
at Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider.<GetSuppressionsAsync>d__38.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 
at Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider.<GetSuppressionsAsync>d__36.MoveNext() --- End of stack trace from previous location where exception was thrown --- 
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.<PerformFunctionAsync>d__3`1.MoveNext()

Contributor guide