@@ -12,12 +12,16 @@ import { IRazorDocumentManager } from '../document/IRazorDocumentManager';
1212import { razorExtensionId } from '../razorExtensionId' ;
1313import { IReportIssueDataCollectionResult } from './IReportIssueDataCollectionResult' ;
1414import { HtmlDocumentManager } from '../../../lsptoolshost/razor/htmlDocumentManager' ;
15+ import { ShowGeneratedDocumentCommand } from '../../../lsptoolshost/razor/showGeneratedDocumentCommand' ;
16+ import { GeneratedDocumentKind } from '../../../lsptoolshost/razor/generatedDocumentKind' ;
17+ import { RoslynLanguageServer } from '../../../lsptoolshost/server/roslynLanguageServer' ;
1518
1619export class ReportIssueCreator {
1720 constructor (
1821 private readonly vscodeApi : vscodeAdapter . api ,
1922 private readonly documentManager ?: IRazorDocumentManager ,
20- private readonly cohostingDocumentManager ?: HtmlDocumentManager
23+ private readonly cohostingDocumentManager ?: HtmlDocumentManager ,
24+ private readonly roslynLanguageServer ?: RoslynLanguageServer
2125 ) { }
2226
2327 public async create ( collectionResult : IReportIssueDataCollectionResult ) {
@@ -37,7 +41,15 @@ export class ReportIssueCreator {
3741 csharpContent = await this . getProjectedCSharp ( razorDocument ) ;
3842 htmlContent = await this . getProjectedHtml ( razorDocument ) ;
3943 } else if ( this . cohostingDocumentManager ) {
40- csharpContent = vscode . l10n . t ( 'Cohosting is on, client has no access to CSharp content' ) ;
44+ try {
45+ csharpContent = await ShowGeneratedDocumentCommand . getGeneratedDocumentContent (
46+ collectionResult . document . uri ,
47+ GeneratedDocumentKind . CSharp ,
48+ this . roslynLanguageServer !
49+ ) ;
50+ } catch ( e : any ) {
51+ csharpContent = vscode . l10n . t ( 'Could not determine CSharp content: {0}' , e . toString ( ) ) ;
52+ }
4153
4254 const htmlDocument = await this . cohostingDocumentManager . getDocument ( collectionResult . document . uri ) ;
4355 if ( htmlDocument ) {
0 commit comments