diff --git a/src/Migrations/BackoutCommits/BackoutCommits.csproj b/src/Migrations/BackoutCommits/BackoutCommits.csproj
index 9237aaa4fe..189b6e5501 100644
--- a/src/Migrations/BackoutCommits/BackoutCommits.csproj
+++ b/src/Migrations/BackoutCommits/BackoutCommits.csproj
@@ -3,7 +3,7 @@
-
+
diff --git a/src/SIL.XForge.Scripture/SIL.XForge.Scripture.csproj b/src/SIL.XForge.Scripture/SIL.XForge.Scripture.csproj
index d4c49194f2..f50af68bbc 100644
--- a/src/SIL.XForge.Scripture/SIL.XForge.Scripture.csproj
+++ b/src/SIL.XForge.Scripture/SIL.XForge.Scripture.csproj
@@ -39,7 +39,7 @@
-
+
diff --git a/src/SIL.XForge.Scripture/Services/NotesFormatter.cs b/src/SIL.XForge.Scripture/Services/NotesFormatter.cs
index aa786d74a6..40f15e27c7 100644
--- a/src/SIL.XForge.Scripture/Services/NotesFormatter.cs
+++ b/src/SIL.XForge.Scripture/Services/NotesFormatter.cs
@@ -209,8 +209,11 @@ private static void ParseContents(XElement? contentElem, Comment comment)
contents = sb.ToString();
}
- comment.AddTextToContent(string.Empty, false);
- comment.Contents.InnerXml = contents;
+ // Since PTX-23738 we must create the contents node,
+ // as the setter for Contents reads and stores the OuterXml
+ XmlElement contentsElement = comment.GetOrCreateCommentNode();
+ contentsElement.InnerXml = contents;
+ comment.Contents = contentsElement;
}
private static void ParseParagraph(XElement paraElem, StringBuilder sb)
diff --git a/src/SIL.XForge.Scripture/Services/ParatextService.cs b/src/SIL.XForge.Scripture/Services/ParatextService.cs
index 27f5514136..3f2a223038 100644
--- a/src/SIL.XForge.Scripture/Services/ParatextService.cs
+++ b/src/SIL.XForge.Scripture/Services/ParatextService.cs
@@ -22,7 +22,6 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
-using MongoDB.Driver.Linq;
using Newtonsoft.Json.Linq;
using Paratext.Data;
using Paratext.Data.Languages;
@@ -1050,7 +1049,8 @@ public async Task PutBookText(
scrText.ScrStylesheet(bookNum),
usx.CreateNavigator(),
XPathExpression.Compile("*[false()]"),
- out string usfm
+ out string usfm,
+ scrText.Settings.AllowInvisibleChars
);
log.AppendLine($"Created usfm of {usfm}");
// Among other things, normalizing the USFM will remove trailing spaces at the end of verses,
@@ -2911,9 +2911,11 @@ Dictionary ptProjectUsers
{
try
{
- if (comment.Contents == null)
- comment.AddTextToContent(string.Empty, false);
- comment.Contents!.InnerXml = xml;
+ // Since PTX-23738 we must create the contents node,
+ // as the setter for Contents reads and stores the OuterXml
+ XmlElement contentsElement = comment.GetOrCreateCommentNode();
+ contentsElement.InnerXml = xml;
+ comment.Contents = contentsElement;
comment.VersionNumber++;
commentUpdated = true;
}
@@ -3181,7 +3183,14 @@ bool isFirstComment
comment.Deleted = note.Deleted;
if (!string.IsNullOrEmpty(note.Content))
- comment.GetOrCreateCommentNode().InnerXml = GetCommentContentsFromNote(note, displayNames, ptProjectUsers);
+ {
+ // Since PTX-23738 we must create the contents node,
+ // as the setter for Contents reads and stores the OuterXml
+ XmlElement contentsElement = comment.GetOrCreateCommentNode();
+ contentsElement.InnerXml = GetCommentContentsFromNote(note, displayNames, ptProjectUsers) ?? string.Empty;
+ comment.Contents = contentsElement;
+ }
+
if (!_userSecretRepository.Query().Any(u => u.Id == note.OwnerRef))
comment.ExternalUser = note.OwnerRef;
comment.TagsAdded =
diff --git a/test/SIL.XForge.Scripture.Tests/Services/DeltaUsxMapperTests.cs b/test/SIL.XForge.Scripture.Tests/Services/DeltaUsxMapperTests.cs
index 612efe89e7..72be78da26 100644
--- a/test/SIL.XForge.Scripture.Tests/Services/DeltaUsxMapperTests.cs
+++ b/test/SIL.XForge.Scripture.Tests/Services/DeltaUsxMapperTests.cs
@@ -12,6 +12,7 @@
using Newtonsoft.Json.Linq;
using NSubstitute;
using NUnit.Framework;
+using Paratext.Data;
using SIL.XForge.Realtime.RichText;
using SIL.XForge.Scripture.Models;
@@ -24,6 +25,7 @@ public class DeltaUsxMapperTests
private IGuidService _testGuidService;
private ILogger _logger;
private IExceptionHandler _exceptionHandler;
+ private ScrText _scrText;
[SetUp]
public void Init()
@@ -32,6 +34,7 @@ public void Init()
_testGuidService = new TestGuidService();
_logger = Substitute.For>();
_exceptionHandler = Substitute.For();
+ _scrText = new MockScrText(new SFParatextUser("ptUser01"), new ProjectName());
}
[Test]
@@ -2825,8 +2828,9 @@ public void ToDelta_TableInMiddleFollowedByCharStyle()
\p E
\v 2 F \nd ND\nd*
""";
- XmlDocument usfmToUsxLoading = Paratext.Data.UsfmToUsx.ConvertToXmlDocument(
- new Paratext.Data.MockScrStylesheet("usfm.sty"),
+ XmlDocument usfmToUsxLoading = UsfmToUsx.ConvertToXmlDocument(
+ _scrText,
+ new MockScrStylesheet("usfm.sty"),
bookUsfm
);
using XmlNodeReader nodeReader = new(usfmToUsxLoading);
@@ -3703,8 +3707,9 @@ private bool DoesRoundtrip(string bookUsfm, out string errorMessage)
{
string bookCode = ExtractBookCode(bookUsfm);
- XmlDocument bookUsxLoading = Paratext.Data.UsfmToUsx.ConvertToXmlDocument(
- new Paratext.Data.MockScrStylesheet("usfm.sty"),
+ XmlDocument bookUsxLoading = UsfmToUsx.ConvertToXmlDocument(
+ _scrText,
+ new MockScrStylesheet("usfm.sty"),
bookUsfm
);
using XmlNodeReader nodeReader = new(bookUsxLoading);
diff --git a/tools/CommentGenerator/CommentGenerator.csproj b/tools/CommentGenerator/CommentGenerator.csproj
index e400c379b8..efa931f96e 100644
--- a/tools/CommentGenerator/CommentGenerator.csproj
+++ b/tools/CommentGenerator/CommentGenerator.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/tools/RepoInfo/RepoInfo.csproj b/tools/RepoInfo/RepoInfo.csproj
index 050c08ad6b..4f92d312da 100644
--- a/tools/RepoInfo/RepoInfo.csproj
+++ b/tools/RepoInfo/RepoInfo.csproj
@@ -45,7 +45,7 @@
-
+