Hi,
While debugging my app I
found a strange call stack in a place I didn’t expect.
Actually after several
testes I discovered a similar call stack on most of my calls.
The issue seems to be
triggered by a “BeginInvoke” triggered from a background thread.
However all the code is
executed on one domain (the one that started the app and created the main
window).
This cross-domain
serialization and code security checking is a big overhead on the application.
How can I avoid this?
[Code security check
across domains is in red]
[My code is in italics]
[Bold/Italics is the
entry point from the BeginInvoke]
Thank you,
Corneliu.
mscorlib.dll!System.Type.get_IsArray()
+ 0xe bytes
mscorlib.dll!System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(System.Object
obj = {System.Security.Permissions.UIPermission},
System.Runtime.Serialization.ISurrogateSelector surrogateSelector =
{System.Runtime.Remoting.Messaging.RemotingSurrogateSelector},
System.Runtime.Serialization.StreamingContext context =
{System.Runtime.Serialization.StreamingContext},
System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit
serObjectInfoInit = {System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit},
System.Runtime.Serialization.IFormatterConverter converter =
{System.Runtime.Serialization.FormatterConverter}) + 0x90 bytes
mscorlib.dll!System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.Serialize(System.Object
obj = {System.Security.Permissions.UIPermission},
System.Runtime.Serialization.ISurrogateSelector surrogateSelector =
{System.Runtime.Remoting.Messaging.RemotingSurrogateSelector},
System.Runtime.Serialization.StreamingContext context = {System.Runtime.Serialization.StreamingContext},
System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit
serObjectInfoInit =
{System.Runtime.Serialization.Formatters.Binary.SerObjectInfoInit},
System.Runtime.Serialization.IFormatterConverter converter = {System.Runtime.Serialization.FormatterConverter})
+ 0x36 bytes
mscorlib.dll!System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(System.Object
graph = {System.Security.Permissions.UIPermission},
System.Runtime.Remoting.Messaging.Header[] inHeaders = <undefined value>,
System.Runtime.Serialization.Formatters.Binary.__BinaryWriter serWriter =
{System.Runtime.Serialization.Formatters.Binary.__BinaryWriter}, bool fCheck =
false) + 0x43e bytes
mscorlib.dll!System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(System.IO.Stream
serializationStream = {System.IO.MemoryStream}, System.Object graph =
{System.Security.Permissions.UIPermission},
System.Runtime.Remoting.Messaging.Header[] headers = <undefined value>,
bool fCheck = false) + 0x10f
bytes
mscorlib.dll!System.Runtime.Remoting.Channels.CrossAppDomainSerializer.SerializeObject(System.Object
obj = {System.Security.Permissions.UIPermission}) + 0x9f
bytes
mscorlib.dll!System.AppDomain.Serialize(System.Object
o = {System.Security.Permissions.UIPermission}) + 0x19
bytes
mscorlib.dll!System.AppDomain.MarshalObject(System.Object
o = {System.Security.Permissions.UIPermission}) + 0x1d bytes
mscorlib.dll!System.Security.CodeAccessSecurityEngine.PreCheck(System.Security.CodeAccessPermission
permObj = {System.Security.Permissions.UIPermission},
System.Security.PermissionSet permSetObj = <undefined value>, int
capOrSet = 1, System.Threading.StackCrawlMark stackMark =
LookForMyCallersCaller, System.Security.PermissionType permType = DefaultFlag)
+ 0x31 bytes
mscorlib.dll!System.Security.CodeAccessSecurityEngine.Check(System.Security.CodeAccessPermission
cap = {System.Security.Permissions.UIPermission},
System.Threading.StackCrawlMark stackMark = LookForMyCallersCaller) + 0x1f
bytes
mscorlib.dll!System.Security.CodeAccessPermission.Demand()
+ 0x3c bytes
system.windows.forms.dll!System.Windows.Forms.Control.FromHandle(int
handle = 2625758) + 0x23 bytes
devexpress.utils.dll!DevExpress.Utils.Win.Hook.HookManager.WndHook(int
ncode = 0, int wParam = 0, int lParam = 1238416) + 0xc2
bytes
system.windows.forms.dll!System.Windows.Forms.Control.UpdateChildZOrder(System.Windows.Forms.Control
ctl = {DevExpress.XtraBars.BarDockControl}) + 0x26b
bytes
system.windows.forms.dll!System.Windows.Forms.Control.SetParentHandle(int
value = 2756886) + 0x293 bytes
system.windows.forms.dll!System.Windows.Forms.Control.CreateControl(bool
fIgnoreVisible = false) + 0x1b3 bytes
system.windows.forms.dll!System.Windows.Forms.Control.CreateControl()
+ 0xe bytes
system.windows.forms.dll!System.Windows.Forms.Control.ControlCollection.Add(System.Windows.Forms.Control
value = {MetaBit.Xilix.SingleBO.SinglePanel}) + 0x2ef
bytes
>
metabit.xilix.basevsp.dll!MetaBit.Xilix.BaseVSP.Panels.PanelUtils.RegisterPanel(MetaBit.Xilix.VSP.IVSPPanel
panel = {MetaBit.Xilix.SingleBO.SinglePanel}, string name = "SinglePanel",
System.Windows.Forms.Control hostControl = {System.Windows.Forms.Panel}, bool
sharedToolbar = true) Line 22 + 0x2c
bytes C#
metabit.xilix.basevsp.dll!MetaBit.Xilix.BaseVSP.Panels.PanelInfoList.RegisterPanel(MetaBit.Xilix.VSP.IVSPPanel
panel = {MetaBit.Xilix.SingleBO.SinglePanel}, string name =
"SinglePanel", System.Windows.Forms.Control hostControl =
{System.Windows.Forms.Panel}, bool sharedToolbar = true, bool innerPanel =
false) Line 62 C#
metabit.xilix.basevsp.dll!MetaBit.Xilix.BaseVSP.BaseView.RegisterPanel(MetaBit.Xilix.VSP.IVSPPanel
panel = {MetaBit.Xilix.SingleBO.SinglePanel}, string name =
"SinglePanel", System.Windows.Forms.Control hostControl =
{System.Windows.Forms.Panel}, bool sharedToolbar = true, bool innerPanel =
false) Line 463 C#
metabit.xilix.singlebo.dll!MetaBit.Xilix.SingleBO.SingleView.Initialize()
Line 98 + 0x55 bytes C#
metabit.xilix.singlebo.dll!MetaBit.Xilix.SingleBO.SingleView.SingleView(string
viewName = "Single") Line 36 C#
metabit.xilix.singlebo.dll!MetaBit.Xilix.SingleBO.SingleBO.GetNewView()
Line 70 + 0x1a bytes C#
metabit.xilix.main.dll!MetaBit.Xilix.Main.Views.ViewManager.LoadSettings(MetaBit.Xilix.Settings.SettingsItem
parentitem = {MetaBit.Xilix.Settings.SettingsItem}) Line 264 + 0x11 bytes C#
metabit.xilix.main.dll!MetaBit.Xilix.Main.Windows.MainWindow.LoadSettings(MetaBit.Xilix.Settings.SettingsItem
parentitem = {MetaBit.Xilix.Settings.SettingsItem}) Line
1090 C#
metabit.xilix.main.dll!MetaBit.Xilix.Main.Windows.WindowManager.LoadSettings(MetaBit.Xilix.Settings.SettingsItem
parentitem = {MetaBit.Xilix.Settings.SettingsItem}) Line 266 + 0x26
bytes C#
metabit.xilix.main.dll!MetaBit.Xilix.Main.XilixMain.LoadSettings(MetaBit.Xilix.Settings.SettingsItem
parentitem = {MetaBit.Xilix.Settings.AppSettings}) Line
219 C#
metabit.xilix.main.dll!MetaBit.Xilix.Main.XilixMain.Builder_StartInitializeApplication(System.Object
sender = {MetaBit.Xilix.AppBuilder.Builder}, System.EventArgs e =
{System.EventArgs}) Line 108 C#
metabit.xilix.appbuilder.dll!MetaBit.Xilix.AppBuilder.Builder.DoStartInitializeApplication()
Line 440 C#
metabit.xilix.appbuilder.dll!MetaBit.Xilix.AppBuilder.Builder.BusinessServices_PermissionsLoaded(System.Object
sender = {MetaBit.Xilix.BS.BusinessServices}, System.EventArgs e =
{System.EventArgs}) Line 426 C#
metabit.xilix.bs.dll!MetaBit.Xilix.BS.BusinessServices.FirePermissionsLoaded()
Line 194 C#
mscorlib.dll!System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Object
obj = {MetaBit.Xilix.BS.BusinessServices}, System.Reflection.BindingFlags
invokeAttr = Default, System.Reflection.Binder binder = <undefined
value>, System.Object[] parameters = <undefined value>,
System.Globalization.CultureInfo culture = <undefined value>, bool
verifyAccess = false) + 0x2cc bytes
mscorlib.dll!System.Delegate.DynamicInvokeImpl(System.Object[]
args = <undefined value>) + 0x3e bytes
mscorlib.dll!System.MulticastDelegate.DynamicInvokeImpl(System.Object[]
args = <undefined value>) + 0x2d bytes
mscorlib.dll!System.Delegate.DynamicInvoke(System.Object[]
args = <undefined value>) + 0x10
bytes
system.windows.forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks()
+ 0x203 bytes
system.windows.forms.dll!System.Windows.Forms.Control.WndProc(System.Windows.Forms.Message
m = {System.Windows.Forms.Message}) + 0x7d5 bytes
system.windows.forms.dll!System.Windows.Forms.ScrollableControl.WndProc(System.Windows.Forms.Message
m = {System.Windows.Forms.Message}) + 0x6c bytes
system.windows.forms.dll!System.Windows.Forms.ContainerControl.WndProc(System.Windows.Forms.Message
m = {System.Windows.Forms.Message}) + 0x37 bytes
system.windows.forms.dll!System.Windows.Forms.Application.ParkingWindow.WndProc(System.Windows.Forms.Message
m = {System.Windows.Forms.Message}) + 0x22
bytes
system.windows.forms.dll!ControlNativeWindow.OnMessage(System.Windows.Forms.Message
m = {System.Windows.Forms.Message}) + 0x13 bytes
system.windows.forms.dll!ControlNativeWindow.WndProc(System.Windows.Forms.Message
m = {System.Windows.Forms.Message}) + 0xda
bytes
system.windows.forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(int
hWnd = 2623412, int msg = 49807, int wparam = 0, int lparam = 0) + 0x3d
bytes
system.windows.forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(int
dwComponentID = 1, int reason = -1, int pvLoopData = 0) + 0x349 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoopInner(int
reason = -1, System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x1f3 bytes
system.windows.forms.dll!ThreadContext.RunMessageLoop(int
reason = -1, System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.ApplicationContext}) + 0x50
bytes
system.windows.forms.dll!System.Windows.Forms.Application.Run(System.Windows.Forms.Form
mainForm = {MetaBit.Xilix.Main.Windows.TrayWindow}) + 0x34
bytes
metabit.xilix.main.dll!MetaBit.Xilix.Main.XilixMain.Startup()
Line 86 C#
MetaBit.Xilix.exe!MetaBit.Xilix.MetaBitXilix.Main()
Line 48 + 0x12 bytes C#