@@ -138,6 +138,42 @@ public async Task VerifyMultipleAttributesOnSameLineForAssemblyAsync()
138138 await this . VerifyCSharpFixAsync ( testCode , fixedTestCode ) . ConfigureAwait ( false ) ;
139139 }
140140
141+ /// <summary>
142+ /// Verifies that multiple attributes on the same line, directly in front of a namespace declaration will produce the expected diagnostic.
143+ /// </summary>
144+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
145+ [ Fact ]
146+ public async Task VerifyMultipleAttributesBeforeNamespaceAsync ( )
147+ {
148+ var testCode = @"using System;
149+ using System.Runtime.InteropServices;
150+
151+ [assembly:CLSCompliant(false)][assembly:ComVisible(true)]
152+ namespace TestNamespace
153+ {
154+ }
155+ " ;
156+
157+ var fixedTestCode = @"using System;
158+ using System.Runtime.InteropServices;
159+
160+ [assembly:CLSCompliant(false)]
161+ [assembly:ComVisible(true)]
162+ namespace TestNamespace
163+ {
164+ }
165+ " ;
166+
167+ DiagnosticResult [ ] expected =
168+ {
169+ this . CSharpDiagnostic ( ) . WithLocation ( 4 , 31 )
170+ } ;
171+
172+ await this . VerifyCSharpDiagnosticAsync ( testCode , expected , CancellationToken . None ) . ConfigureAwait ( false ) ;
173+ await this . VerifyCSharpDiagnosticAsync ( fixedTestCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
174+ await this . VerifyCSharpFixAsync ( testCode , fixedTestCode ) . ConfigureAwait ( false ) ;
175+ }
176+
141177 /// <summary>
142178 /// Verifies that multiple attributes on the same line for module level will produce the expected diagnostic.
143179 /// </summary>
@@ -366,6 +402,33 @@ public bool TestMethod2([In][MarshalAs(UnmanagedType.I4)] int value)
366402 await this . VerifyCSharpFixAsync ( testCode , fixedTestCode ) . ConfigureAwait ( false ) ;
367403 }
368404
405+ /// <summary>
406+ /// Verifies that multiple attributes on the same line for a generic parameter will produce the expected diagnostic.
407+ /// </summary>
408+ /// <returns>A <see cref="Task"/> representing the asynchronous unit test.</returns>
409+ [ Fact ]
410+ public async Task VerifyMultipleAttributesOnSameLineForGenericParameterAsync ( )
411+ {
412+ var testCode = @"using System;
413+
414+ namespace TestNamespace
415+ {
416+ [AttributeUsage(System.AttributeTargets.All, AllowMultiple = true)]
417+ public sealed class TestAttribute : Attribute
418+ {
419+ public string Param { get; private set; }
420+ public TestAttribute(string param) { Param = param; }
421+ }
422+
423+ public class TestClass<[Test(""Test1"")][Test(""Test2"")]T>
424+ {
425+ }
426+ }
427+ " ;
428+
429+ await this . VerifyCSharpDiagnosticAsync ( testCode , EmptyDiagnosticResults , CancellationToken . None ) . ConfigureAwait ( false ) ;
430+ }
431+
369432 /// <inheritdoc/>
370433 protected override CodeFixProvider GetCSharpCodeFixProvider ( )
371434 {
0 commit comments