New bug in ApplyTemplate method after V2.1.0 released
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start at ApplyTemplate(Stream templateStream, bool includeContent) and reproduce the failure with the provided code using a DOCX containing an empty paragraph. Read the Paragraphs collection behavior and paragraph.Remove(false), especially RemoveParagraphFromCache; done means ApplyTemplate with includeContent set to false completes without InvalidOperationException.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hello,
My old code stopped working after I updated nuget package from V2.0.0 to V2.3.0. The reason is that ApplyTemplate( Stream templateStream, bool includeContent ) method now throws an System.InvalidOperationException when includeContent is set to false because of those reasons:
if( !includeContent )
{
foreach( Paragraph paragraph in this.Paragraphs )
{
paragraph.Remove( false );
}
}
In this part of ApplyTemplate method paragraph.Remove( false ); modifies Paragraphs collection, and this causes foreach-loop to break. This is happening because in V2.1.0 (commit 9c431afb) realization of Paragraphs collection was changed and now there is underlying List<Paragraph> _editableParagraphsCollection list which is modified when paragraph.Remove( false ); calls RemoveParagraphFromCache( paragraph );
The code to reproduce the bug is as simple as that:
using (var document = DocX.Create("test.docx"))
{
using (var templateStream = new FileStream("template.docx", FileMode.Open, FileAccess.Read))
{
document.ApplyTemplate(templateStream, false);
}
document.Save();
}
where template.docx is any docx created in MS Word, because even empty document includes one empty paragraph. I'm not sure which is the most accurate way to fix this issue.
- Lenguaje dominante
- C#
- Estrellas
- 1.9k
- Forks
- 482
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de xceedsoftware/DocX
-
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
xceedsoftware/DocX#489 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
xceedsoftware/DocX#488 · 1 comentario · 1 reacción ·
-
keep formatAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 25/100
xceedsoftware/DocX#487 · 3 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 45/100
xceedsoftware/DocX#485 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
xceedsoftware/DocX#482 · 4 comentarios ·
Todos los issues de xceedsoftware/DocX
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
:watch: Not Triaged aspnet-core/svc fundamentals/subsvc Source - Docs.ms
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
dotnet/AspNetCore.Docs#37785 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Azure/azure-sdk-tools#17204 ·
Los mantenedores suelen responder en 1 día
-
Проблема с Dotnet RUAbiertoarea-tutorials needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
dotnet/website-feedback#1779 ·
-
[Bug] SwipeControl in Execute mode with more than one item replaces the whole UI with an error panelPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
microsoft/microsoft-ui-reactor#1344 ·
Los mantenedores suelen responder en 1 día