ArthurHub / ArthurHub/HTML-Renderer

Object reference not set to an instance of an object

Abierto
#123 1 comentario 1 reacción 0 asignados Ver en GitHub
bug PDF
Lenguaje dominante
C#
Estrellas
1.4k
Forks
550
Merge medio
14 d 9 h
PR fusionados (30 d)
1

Descripción

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`

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp
Área
backend
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.