[System] Made ProcessTest.Modules more verbose.
authorMarcos Henrich <marcos.henrich@xamarin.com>
Tue, 9 Jun 2015 16:01:22 +0000 (17:01 +0100)
committerMarcos Henrich <marcos.henrich@xamarin.com>
Fri, 12 Jun 2015 11:31:45 +0000 (12:31 +0100)
When Process.Modules fails it will now print the list of assemblies it
looked into.

mcs/class/System/Test/System.Diagnostics/ProcessTest.cs

index e6337d60976bbf5a277ddc4d984b5c201ebb4fae..14e5dcdca8e22c5dd813e0ce04260e854b2953ad 100644 (file)
@@ -924,13 +924,24 @@ namespace MonoTests.System.Diagnostics
                        p.Dispose ();
                }
 
+               [Test]
                public void Modules () {
                        var modules = Process.GetCurrentProcess ().Modules;
                        foreach (var a in AppDomain.CurrentDomain.GetAssemblies ()) {
                                var found = false;
+                               var name = a.GetName ();
+
+                               StringBuilder sb = new StringBuilder ();
+                               sb.AppendFormat ("Could not found: {0} {1}\n", name.Name, name.Version);
+                               sb.AppendLine ("Looked in assemblies:");
+
                                foreach (var o in modules) {
                                        var m = (ProcessModule) o;
-                                       var name = a.GetName ();
+
+                                       sb.AppendFormat ("   {0} {1}.{2}.{3}\n", m.FileName.ToString (),
+                                                       m.FileVersionInfo.FileMajorPart,
+                                                       m.FileVersionInfo.FileMinorPart,
+                                                       m.FileVersionInfo.FileBuildPart);
 
                                        if (!m.FileName.StartsWith ("[In Memory] " + name.Name))
                                                continue;
@@ -944,7 +955,7 @@ namespace MonoTests.System.Diagnostics
                                        found = true;
                                }
 
-                               Assert.IsTrue (found);
+                               Assert.IsTrue (found, sb.ToString ());
                        }
                }
        }