Skip to content

Commit 267b7ff

Browse files
committed
[mono] XenAdmin: Program: Skip logging GUI resources at boot
This fix disables the functionality that is a cause of exceptions throwing. The negative impact isn't expected, since the disabled code just prints some debugging messages. This doesn't look important. Signed-off-by: Ilya Stolyarov <[email protected]>
1 parent 08b91f6 commit 267b7ff

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

XenAdmin/Program.cs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) Cloud Software Group, Inc.
1+
/* Copyright (c) Cloud Software Group, Inc.
22
*
33
* Redistribution and use in source and binary forms,
44
* with or without modification, are permitted provided
@@ -251,8 +251,11 @@ private static void LogApplicationStats()
251251
log.InfoFormat("Time since process started: {0}", (DateTime.Now - Process.GetCurrentProcess().StartTime).ToString());
252252

253253
log.InfoFormat("Handles open: {0}", p.HandleCount.ToString());
254-
log.InfoFormat("USER handles open: {0}", Win32.GetGuiResourcesUserCount(p.Handle));
255-
log.InfoFormat("GDI handles open: {0}", Win32.GetGuiResourcesGDICount(p.Handle));
254+
if (System.Type.GetType("Mono.Runtime") == null)
255+
{
256+
log.InfoFormat("USER handles open: {0}", Win32.GetGuiResourcesUserCount(p.Handle));
257+
log.InfoFormat("GDI handles open: {0}", Win32.GetGuiResourcesGDICount(p.Handle));
258+
}
256259
log.InfoFormat("Thread count: {0}", p.Threads.Count);
257260

258261
log.InfoFormat("Virtual memory size: {0} B({1})", p.VirtualMemorySize64, Util.MemorySizeStringSuitableUnits(p.VirtualMemorySize64, false));

0 commit comments

Comments
 (0)