Skip to content

Commit 1210a7b

Browse files
gbchars (#8151)
1 parent 07f34ba commit 1210a7b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,12 @@ private bool ExecuteLegacyGenerateTemporaryTargetAssembly()
122122
XmlDocument xmlProjectDoc = null;
123123

124124
xmlProjectDoc = new XmlDocument( );
125-
xmlProjectDoc.Load(CurrentProject);
126-
125+
//Bugfix for GB chars, exception thrown when using Load(CurrentProject), when project name has GB characters in it.
126+
//Using a filestream instead of using string path to avoid the need to properly compose Uri (which is another way of fixing - but more complicated).
127+
using(FileStream fs = File.OpenRead(CurrentProject))
128+
{
129+
xmlProjectDoc.Load(fs);
130+
}
127131
//
128132
// remove all the WinFX specific item lists
129133
// ApplicationDefinition, Page, MarkupResource and Resource
@@ -247,8 +251,12 @@ private bool ExecuteGenerateTemporaryTargetAssemblyWithPackageReferenceSupport()
247251
XmlDocument xmlProjectDoc = null;
248252

249253
xmlProjectDoc = new XmlDocument( );
250-
xmlProjectDoc.Load(CurrentProject);
251-
254+
//Bugfix for GB chars, exception thrown when using Load(CurrentProject), when project name has GB characters in it.
255+
//Using a filestream instead of using string path to avoid the need to properly compose Uri (which is another way of fixing - but more complicated).
256+
using(FileStream fs = File.OpenRead(CurrentProject))
257+
{
258+
xmlProjectDoc.Load(fs);
259+
}
252260
// remove all the WinFX specific item lists
253261
// ApplicationDefinition, Page, MarkupResource and Resource
254262
RemoveItemsByName(xmlProjectDoc, APPDEFNAME);

0 commit comments

Comments
 (0)