protected override void ExecuteCore(RazorCodeDocument codeDocument)
    {
        var documentNode = codeDocument.GetDocumentIntermediateNode();

        ThrowForMissingDocumentDependency(documentNode);

        var target = documentNode.Target;

        if (target == null)
        {
            var message = Resources.FormatDocumentMissingTarget(
                documentNode.DocumentKind,
                nameof(CodeTarget),
                nameof(DocumentIntermediateNode.Target));
            throw new InvalidOperationException(message);
        }

        var writer         = DocumentWriter.CreateDefault(documentNode.Target, documentNode.Options);
        var cSharpDocument = writer.WriteDocument(codeDocument, documentNode);

        codeDocument.SetCSharpDocument(cSharpDocument);
    }