InvalidCastException in SmartyPantsInlineParser #40

Closed
opened 2026-01-29 14:22:22 +00:00 by claunia · 1 comment
Owner

Originally created by @Jither on GitHub (Jun 28, 2016).

No pull request for this one, sorry ---(*) until Github figures out I'm human. 😈 Besides, I'm not quite sure I follow the reasoning in the SmartyPants parser (I know changes were made to fix the table rendering).

However, test case:

        [Test]
        public void TestInvalidCastBug()
        {
            var pipeline = new MarkdownPipelineBuilder()
                .UseSmartyPants()
                .Build();
            var md = "\"Curly\" quotations and dashes --- like that one.";
            Assert.DoesNotThrow(() => Markdown.Parse(md, pipeline));
        }

Markdig throws an InvalidCastException:
Unable to cast object of type 'System.String' to type 'System.Collections.Generic.List`1[Markdig.Extensions.SmartyPants.SmartyPant]

Seems to be due to the dashes logic writing String.Empty, overwriting the list created by the quotation marks, in ParserState[Index].

(*) Written too many m-dashes today, it seems. ;-)

Originally created by @Jither on GitHub (Jun 28, 2016). No pull request for this one, sorry ---(*) until Github figures out I'm human. :smiling_imp: Besides, I'm not quite sure I follow the reasoning in the SmartyPants parser (I know changes were made to fix the table rendering). However, test case: ``` csharp [Test] public void TestInvalidCastBug() { var pipeline = new MarkdownPipelineBuilder() .UseSmartyPants() .Build(); var md = "\"Curly\" quotations and dashes --- like that one."; Assert.DoesNotThrow(() => Markdown.Parse(md, pipeline)); } ``` Markdig throws an InvalidCastException: Unable to cast object of type 'System.String' to type 'System.Collections.Generic.List`1[Markdig.Extensions.SmartyPants.SmartyPant] Seems to be due to the dashes logic writing `String.Empty`, overwriting the list created by the quotation marks, in `ParserState[Index]`. (*) Written too many m-dashes today, it seems. ;-)
Author
Owner

@Jither commented on GitHub (Jul 5, 2016):

I'm finally back from the dead/blocked 😃 - and so are any issues comments I've made. As you know, this was fixed in 0.7.1 - so this can be closed.

@Jither commented on GitHub (Jul 5, 2016): I'm finally back from the dead/blocked :smiley: - and so are any issues comments I've made. As you know, this was fixed in 0.7.1 - so this can be closed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#40