File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
Tasks.UnitTests/AssemblyDependency Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -2911,7 +2911,7 @@ private static DateTime GetLastWriteTime(string path)
29112911 /// </summary>
29122912 /// <param name="appConfigFile"></param>
29132913 /// <param name="redirects"></param>
2914- protected static string WriteAppConfig ( string redirects )
2914+ protected static string WriteAppConfig ( string redirects , string appConfigNameSuffix = null )
29152915 {
29162916 string appConfigContents =
29172917 "<configuration>\n " +
@@ -2920,7 +2920,7 @@ protected static string WriteAppConfig(string redirects)
29202920 " </runtime>\n " +
29212921 "</configuration>" ;
29222922
2923- string appConfigFile = FileUtilities . GetTemporaryFileName ( ) ;
2923+ string appConfigFile = FileUtilities . GetTemporaryFileName ( ) + appConfigNameSuffix ;
29242924 File . WriteAllText ( appConfigFile , appConfigContents ) ;
29252925 return appConfigFile ;
29262926 }
Original file line number Diff line number Diff line change @@ -38,13 +38,16 @@ public StronglyNamedDependencyAppConfig(ITestOutputHelper output) : base(output)
3838 /// - An app.config was passed in that promotes UnifyMe version from 1.0.0.0 to 2.0.0.0
3939 /// - Version 1.0.0.0 of UnifyMe exists.
4040 /// - Version 2.0.0.0 of UnifyMe exists.
41+ /// - The case is attempted on special unicode characters in path as well.
4142 /// Expected:
4243 /// - The resulting UnifyMe returned should be 2.0.0.0.
4344 /// Rationale:
4445 /// Strongly named dependencies should unify according to the bindingRedirects in the app.config.
4546 /// </summary>
46- [ Fact ]
47- public void Exists ( )
47+ [ Theory ]
48+ [ InlineData ( null ) ]
49+ [ InlineData ( "\uE025 \uE026 " ) ]
50+ public void Exists ( string appConfigNameSuffix )
4851 {
4952 // Create the engine.
5053 MockEngine engine = new MockEngine ( _output ) ;
@@ -59,7 +62,8 @@ public void Exists()
5962 " <dependentAssembly>\n " +
6063 " <assemblyIdentity name='UnifyMe' PublicKeyToken='b77a5c561934e089' culture='neutral' />\n " +
6164 " <bindingRedirect oldVersion='1.0.0.0' newVersion='2.0.0.0' />\n " +
62- " </dependentAssembly>\n " ) ;
65+ " </dependentAssembly>\n " ,
66+ appConfigNameSuffix ) ;
6367
6468 // Now, pass feed resolved primary references into ResolveAssemblyReference.
6569 ResolveAssemblyReference t = new ResolveAssemblyReference ( ) ;
Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33
44using System ;
5+ using System . IO ;
56using System . Xml ;
67
78using Microsoft . Build . Shared ;
@@ -24,13 +25,16 @@ internal void Load(string appConfigFile)
2425 XmlReader reader = null ;
2526 try
2627 {
27- var readerSettings = new XmlReaderSettings { DtdProcessing = DtdProcessing . Ignore } ;
28+ var readerSettings = new XmlReaderSettings { DtdProcessing = DtdProcessing . Ignore , CloseInput = true } ;
2829
2930 // it's important to normalize the path as it may contain two slashes
3031 // see https://github.com/dotnet/msbuild/issues/4335 for details.
3132 appConfigFile = FileUtilities . NormalizePath ( appConfigFile ) ;
3233
33- reader = XmlReader . Create ( appConfigFile , readerSettings ) ;
34+ // Need a filestream as the XmlReader doesn't support nonstandard unicode characters in path.
35+ // No need to dispose - as 'CloseInput' was passed to XmlReaderSettings
36+ FileStream fs = File . OpenRead ( appConfigFile ) ;
37+ reader = XmlReader . Create ( fs , readerSettings ) ;
3438 Read ( reader ) ;
3539 }
3640 catch ( XmlException e )
You can’t perform that action at this time.
0 commit comments