ArthurHub / ArthurHub/HTML-Renderer

Object reference not set to an instance of an object

Ouverte
#123 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
bug PDF
Langage dominant
C#
Étoiles
1.4k
Forks
550
Merge moyen
14 j 9 h
PR mergées (30 j)
1

Description

Sometimes when calling:

TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdf

I get this exception:

at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at TheArtOfDev.HtmlRenderer.Core.Parse.RegexParserUtils.GetRegex(String regex) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\RegexParserUtils.cs:line 192
at TheArtOfDev.HtmlRenderer.Core.Parse.RegexParserUtils.Search(String regex, String source, Int32& position) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\RegexParserUtils.cs:line 166
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.ParseFontProperty(String propValue, Dictionary`2 properties) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 536
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.AddProperty(String propName, String propValue, Dictionary`2 properties) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 444
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.ParseCssBlockProperties(String blockSource) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 414
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.ParseCssBlockImp(String className, String blockSource) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 323
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.FeedStyleBlock(CssData cssData, String block, String media) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 291
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.ParseStyleBlocks(CssData cssData, String stylesheet) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 215
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.ParseStyleSheet(CssData cssData, String stylesheet) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 100
at TheArtOfDev.HtmlRenderer.Core.Parse.CssParser.ParseStyleSheet(String stylesheet, Boolean combineWithDefault) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\Parse\CssParser.cs:line 81
at TheArtOfDev.HtmlRenderer.Adapters.RAdapter.get_DefaultCssData() in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Adapters\RAdapter.cs:line 88
at TheArtOfDev.HtmlRenderer.Core.HtmlContainerInt.SetHtml(String htmlSource, CssData baseCssData) in d:\source\github\HTML-Renderer\Source\HtmlRenderer\Core\HtmlContainerInt.cs:line 429
at TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdf(String html, PdfGenerateConfig config, CssData cssData, EventHandler`1 stylesheetLoad, EventHandler`1 imageLoad) in d:\source\github\HTML-Renderer\Source\HtmlRenderer.PdfSharp\PdfGenerator.cs:line 119
at TheArtOfDev.HtmlRenderer.PdfSharp.PdfGenerator.GeneratePdf(String html, PageSize pageSize, Int32 margin, CssData cssData, EventHandler`1 stylesheetLoad, EventHandler`1 imageLoad) in d:\source\github\HTML-Renderer\Source\HtmlRenderer.PdfSharp\PdfGenerator.cs:line 76

It's completely random, couldn't find any pattern...

Version of Core and PdfSharp used:
`1.5.0.6`

Version of PDFSharp used:
`1.32.3057.0`

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Start with Source/HtmlRenderer/Core/Parse/RegexParserUtils.cs at lines 166 and 192, then trace the calls from CssParser.cs line 536 through RAdapter.cs line 88 and PdfGenerator.cs line 119. Try to reproduce the intermittent GeneratePdf failure using the issue's versions and inspect the CSS/font parsing path. Done means identifying the triggering input or condition and documenting a verified fix with a regression test if the repository has an applicable test location.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp
Domaine
backend
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.