-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Copy link
Labels
Area-CompilersBugFeature - Extension EverythingThe extension everything featureThe extension everything feature
Milestone
Description
[Fact]
public void ExtensionInAddedModule()
{
string source = @"
public static class C1
{
extension(int i)
{
}
}
";
var moduleComp = CreateCompilation(source, options: TestOptions.ReleaseModule);
var moduleRef = moduleComp.EmitToImageReference();
CompileAndVerify("", references: [moduleRef]);
}
Observed:
Microsoft.CodeAnalysis.Test.Utilities.CompilationVerifier+EmitException :
// error CS1569: Error writing to XML documentation file: Unable to cast object of type 'PENamedTypeSymbolNonGeneric' to type 'Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol'.
Diagnostic(ErrorCode.ERR_DocFileGen).WithArguments("Unable to cast object of type 'PENamedTypeSymbolNonGeneric' to type 'Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol'.").WithLocation(1, 1)
It looks like DocumentationCommentCompiler should be able to handle extensions represented by non-source symbols:
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'PENamedTypeSymbolNonGeneric' to type 'Microsoft.CodeAnalysis.CSharp.Symbols.SourceMemberContainerTypeSymbol'.
Source=Microsoft.CodeAnalysis.CSharp
StackTrace:
at Microsoft.CodeAnalysis.CSharp.DocumentationCommentCompiler.<VisitNamedType>g__appendContainedExtensions|17_0(NamedTypeSymbol containingType) in D:\GitHub\roslyn\src\Compilers\CSharp\Portable\Compiler\DocumentationCommentCompiler.cs:line 266
Metadata
Metadata
Assignees
Labels
Area-CompilersBugFeature - Extension EverythingThe extension everything featureThe extension everything feature