diff --git a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs index 6b5d0bbf37..3574b831ec 100644 --- a/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs +++ b/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngineBase.cs @@ -349,8 +349,9 @@ namespace ICSharpCode.NRefactory.CSharp.Completion if (nextCh == '/') { i++; IsInSingleComment = true; + IsInPreprocessorDirective = false; } - if (nextCh == '*') + if (nextCh == '*' && !IsInPreprocessorDirective) IsInMultiLineComment = true; break; case '*': diff --git a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/PreProcessorTests.cs b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/PreProcessorTests.cs index 68e3a56428..e7dbf37daf 100644 --- a/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/PreProcessorTests.cs +++ b/ICSharpCode.NRefactory.Tests/CSharp/CodeCompletion/PreProcessorTests.cs @@ -90,5 +90,16 @@ namespace ICSharpCode.NRefactory.CSharp.CodeCompletion provider = CodeCompletionBugTests.CreateProvider (@"$#if TRUE && $", true); Assert.IsNotNull (provider.Find ("DEBUG"), "define 'DEBUG' not found."); } + + + /// + /// Bug 10294 - Comments in preprocessor directives are not handler correctly + /// + [Test] + public void TestBug10294 () + { + var provider = CodeCompletionBugTests.CreateProvider (@"$#if TRUE // D$",true); + Assert.IsTrue (provider == null || provider.Count == 0); + } } }