Toolkit error in Partial Trust XBAP

Apr 21, 2010 at 7:08 PM

Hello

This is using the latest WPF Toolkit (Feb 2010).  I have a chart that changes its data series when a combo box is changed.  When I change the combobox value I get a permissions error that seems to stem from the WPF Toolkit.  It requests <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Window="AllWindows"/> which I can understand why an XBAP would deny. 

Any ideas on how I can get this to not happen?  What I am doing is really not fancy.  I have included the full stack trace below.

This does not cause a problem in a WPF application (I have a web and app version).

thanks Alex

 


Application Identity: , Version=1.0.0.1, Culture=neutral, PublicKeyToken=49ec8f7eb5a8c36b, processorArchitecture=msil/ILPMain.exe, Version=1.0.0.1, Culture=neutral, PublicKeyToken=49ec8f7eb5a8c36b, processorArchitecture=msil, type=win32

System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
   at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
   at System.Security.CodeAccessPermission.Demand()
   at MS.Internal.PresentationCore.SecurityHelper.DemandUIWindowPermission()
   at System.Windows.PresentationSource.FromVisual(Visual visual)
   at System.Windows.VisualStateManager.ShouldRunStateStoryboard(FrameworkElement control, FrameworkElement stateGroupsRoot, VisualState state, VisualStateGroup group)
   at System.Windows.VisualStateManager.<>c__DisplayClass3.<GoToStateInternal>b__0(Object sender, EventArgs e)
   at System.Windows.Media.Animation.Clock.FireEvent(EventPrivateKey key)
   at System.Windows.Media.Animation.Clock.RaiseAccumulatedEvents()
   at System.Windows.Media.Animation.TimeManager.RaiseEnqueuedEvents()
   at System.Windows.Media.Animation.TimeManager.Tick()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.StartDispatcherInBrowser(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at System.Threading.ExecutionContext.runTryCode(Object userData)
   at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)

The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.UIPermission
The first permission that failed was:
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="AllWindows"/>

The demand was for:
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="AllWindows"/>

The granted set of the failing assembly was:
<PermissionSet class="System.Security.PermissionSet"
version="1">
<IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Access="Open"/>
<IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Allowed="ApplicationIsolationByUser"
UserQuota="512000"/>
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="Execution"/>
<IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Window="SafeTopLevelWindows"
Clipboard="OwnClipboard"/>
<IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
version="1"
Level="SafePrinting"/>
<IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Audio="SafeAudio"
Video="SafeVideo"
Image="SafeImage"/>
<IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
version="1"
Level="Safe"/>
<IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1">
<ConnectAccess>
<URI uri="(https)://ilpdev01/.*"/>
</ConnectAccess>
</IPermission>
</PermissionSet>

The assembly or AppDomain that failed was:
WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35
The method that caused the failure was:
Boolean ShouldRunStateStoryboard(System.Windows.FrameworkElement, System.Windows.FrameworkElement, System.Windows.VisualState, System.Windows.VisualStateGroup)
The Zone of the assembly that failed was:
MyComputer
The Url of the assembly that failed was:
file:///C:/Documents and Settings/alo/Local Settings/Apps/2.0/0T7C18RW.YVA/MBJJL1EZ.1Y0/ilpm..xbap_49ec8f7eb5a8c36b_0001.0000_707d36ef42fba960/WPFToolkit.DLL

-----------------------

PresentationHost.exe v3.0.6920.1427 built by: SP - C:\WINDOWS\system32\PresentationHost.exe
ntdll.dll v5.1.2600.5755 (xpsp_sp3_gdr.090206-1234) - C:\WINDOWS\system32\ntdll.dll
kernel32.dll v5.1.2600.5781 (xpsp_sp3_gdr.090321-1317) - C:\WINDOWS\system32\kernel32.dll
ADVAPI32.dll v5.1.2600.5755 (xpsp_sp3_gdr.090206-1234) - C:\WINDOWS\system32\ADVAPI32.dll
RPCRT4.dll v5.1.2600.5795 (xpsp_sp3_gdr.090415-1241) - C:\WINDOWS\system32\RPCRT4.dll
Secur32.dll v5.1.2600.5753 (xpsp_sp3_gdr.090203-1302) - C:\WINDOWS\system32\Secur32.dll
MSVCR80.dll v8.00.50727.3053 - C:\WINDOWS\WinSxS\x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.3053_x-ww_b80fa8ca\MSVCR80.dll
msvcrt.dll v7.0.2600.5512 (xpsp.080413-2111) - C:\WINDOWS\system32\msvcrt.dll
USER32.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\USER32.dll
GDI32.dll v5.1.2600.5698 (xpsp_sp3_gdr.081022-1932) - C:\WINDOWS\system32\GDI32.dll
ole32.dll v5.1.2600.5512 (xpsp.080413-2108) - C:\WINDOWS\system32\ole32.dll
mscoree.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\system32\mscoree.dll
SHLWAPI.dll v6.00.2900.5912 (xpsp_sp3_gdr.091207-1454) - C:\WINDOWS\system32\SHLWAPI.dll
urlmon.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\WINDOWS\system32\urlmon.dll
OLEAUT32.dll v5.1.2600.5512 - C:\WINDOWS\system32\OLEAUT32.dll
iertutil.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\WINDOWS\system32\iertutil.dll
SHELL32.dll v6.00.2900.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\SHELL32.dll
WININET.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\WINDOWS\system32\WININET.dll
Normaliz.dll v6.0.5441.0 (winmain(wmbla).060628-1735) - C:\WINDOWS\system32\Normaliz.dll
IMM32.DLL v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\IMM32.DLL
comctl32.dll v6.0 (xpsp.080413-2105) - C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.5512_x-ww_35d4ce83\comctl32.dll
uxtheme.dll v6.00.2900.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\uxtheme.dll
MSCTF.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\MSCTF.dll
CLBCATQ.DLL v2001.12.4414.700 - C:\WINDOWS\system32\CLBCATQ.DLL
COMRes.dll v2001.12.4414.700 - C:\WINDOWS\system32\COMRes.dll
VERSION.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\VERSION.dll
xpsp2res.dll v5.1.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\xpsp2res.dll
ws2_32.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\ws2_32.dll
WS2HELP.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\WS2HELP.dll
mswsock.dll v5.1.2600.5625 (xpsp_sp3_gdr.080620-1249) - C:\WINDOWS\system32\mswsock.dll
CRYPT32.dll v5.131.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\CRYPT32.dll
MSASN1.dll v5.1.2600.5875 (xpsp_sp3_gdr.090904-1413) - C:\WINDOWS\system32\MSASN1.dll
hnetcfg.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\hnetcfg.dll
wshtcpip.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\System32\wshtcpip.dll
userenv.dll v5.1.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\userenv.dll
netapi32.dll v5.1.2600.5694 (xpsp_sp3_gdr.081015-1312) - C:\WINDOWS\system32\netapi32.dll
wintrust.dll v5.131.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\wintrust.dll
IMAGEHLP.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\IMAGEHLP.dll
schannel.dll v5.1.2600.5721 (xpsp_sp3_gdr.081204-1228) - C:\WINDOWS\system32\schannel.dll
RASAPI32.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\RASAPI32.dll
rasman.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\rasman.dll
TAPI32.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\TAPI32.dll
rtutils.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\rtutils.dll
WINMM.dll v5.1.2600.5512 (xpsp.080413-0845) - C:\WINDOWS\system32\WINMM.dll
sensapi.dll v5.1.2600.5512 (xpsp.080413-2108) - C:\WINDOWS\system32\sensapi.dll
rasadhlp.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\rasadhlp.dll
DNSAPI.dll v5.1.2600.5625 (xpsp_sp3_gdr.080620-1249) - C:\WINDOWS\system32\DNSAPI.dll
msv1_0.dll v5.1.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\msv1_0.dll
iphlpapi.dll v5.1.2600.5512 (xpsp.080413-0852) - C:\WINDOWS\system32\iphlpapi.dll
rsaenh.dll v5.1.2600.5507 (xpsp.080318-1711) - C:\WINDOWS\system32\rsaenh.dll
dssenh.dll v5.1.2600.5507 (xpsp.080318-1711) - C:\WINDOWS\system32\dssenh.dll
dfshim.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\system32\dfshim.dll
mscorwks.dll v2.0.50727.3603 (GDR.050727-3600) - C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorwks.dll
PresentationHostDLL.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\Microsoft.NET\Framework\v3.0\WPF\PresentationHostDLL.dll
PSAPI.DLL v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\PSAPI.DLL
msi.dll v4.5.6001.22159 - C:\WINDOWS\system32\msi.dll
actxprxy.dll v6.00.2900.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\actxprxy.dll
SXS.DLL v5.1.2600.5512 (xpsp.080413-2111) - C:\WINDOWS\system32\SXS.DLL
PresentationHostProxy.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\system32\PresentationHostProxy.dll
ieproxy.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\Program Files\Internet Explorer\ieproxy.dll
msctfime.ime v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\msctfime.ime
mshtml.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\WINDOWS\system32\mshtml.dll
msls31.dll v3.10.349.0 - C:\WINDOWS\system32\msls31.dll
MLANG.dll v6.00.2900.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\MLANG.dll
msimtf.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\msimtf.dll
mslbui.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\mslbui.dll
sptip.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\ime\sptip.dll
OLEACC.dll v4.2.5406.0 (xpclient.010817-1148) - C:\WINDOWS\system32\OLEACC.dll
MSVCP60.dll v6.02.3104.0 - C:\WINDOWS\system32\MSVCP60.dll
SPGRMR.DLL v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\IME\SPGRMR.DLL
SKCHUI.DLL v1.0.1038.0 - C:\Program Files\Common Files\Microsoft Shared\INK\SKCHUI.DLL
IEFRAME.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\WINDOWS\system32\IEFRAME.dll
jscript.dll v5.7.6002.22145 - C:\WINDOWS\system32\jscript.dll
ImgUtil.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\WINDOWS\system32\ImgUtil.dll
pngfilt.dll v7.00.5730.13 (longhorn(wmbla).070711-1130) - C:\WINDOWS\system32\pngfilt.dll
mscorlib.ni.dll v2.0.50727.3603 (GDR.050727-3600) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\mscorlib\4b10d8196bb368996ec5d24fca777456\mscorlib.ni.dll
System.ni.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System\2e356db128ec7354bd70a3ecc84b1f87\System.ni.dll
WindowsBase.ni.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\WindowsBase\c770cdb4fc7f26c9b5fe858d4147ae57\WindowsBase.ni.dll
PresentationCore.ni.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\PresentationCore\4619e16b34a37586c8dbae5f71359156\PresentationCore.ni.dll
PresentationFramework.ni.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\PresentationFramewo#\e3d4d240794478ea8067ceed63bbad1e\PresentationFramework.ni.dll
wpfgfx_v0300.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\Microsoft.NET\Framework\v3.0\WPF\wpfgfx_v0300.dll
PresentationUI.ni.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\PresentationUI\f256e6ef01b68fbc8d60628b5479185b\PresentationUI.ni.dll
msimg32.dll v5.1.2600.5512 (xpsp.080413-2105) - C:\WINDOWS\system32\msimg32.dll
System.Drawing.ni.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Drawing\f9c517646d0706b9c61a41af685ff6b7\System.Drawing.ni.dll
mscorjit.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorjit.dll
PresentationFramework.Luna.ni.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\PresentationFramewo#\70ac14c28100d0ca7ed1170597fbc172\PresentationFramework.Luna.ni.dll
ILPPresentation.dll v1.0.0.0 - C:\Documents and Settings\alo\Local Settings\Apps\2.0\0T7C18RW.YVA\MBJJL1EZ.1Y0\ilpm..xbap_49ec8f7eb5a8c36b_0001.0000_707d36ef42fba960\ILPPresentation.dll
ILPServiceInterface.dll v1.0.0.0 - C:\Documents and Settings\alo\Local Settings\Apps\2.0\0T7C18RW.YVA\MBJJL1EZ.1Y0\ilpm..xbap_49ec8f7eb5a8c36b_0001.0000_707d36ef42fba960\ILPServiceInterface.dll
d3d9.dll v5.03.2600.5512 (xpsp.080413-0845) - C:\WINDOWS\system32\d3d9.dll
d3d8thk.dll v5.03.2600.5512 (xpsp.080413-0845) - C:\WINDOWS\system32\d3d8thk.dll
System.Deployment.ni.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Deployment\6d697a2d4a40e33d2bef6f013bc24172\System.Deployment.ni.dll
System.Configuration.ni.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Configuration\60b25b27fbf5f0f94fd65fcbdc3f3b2b\System.Configuration.ni.dll
System.Xml.ni.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Xml\28cee07c1277b35abcb83560cd8c677c\System.Xml.ni.dll
winrnr.dll v5.1.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\System32\winrnr.dll
WLDAP32.dll v5.1.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\WLDAP32.dll
WindowsCodecs.dll v6.0.6001.17009 (longhorn.070920-1905) - C:\WINDOWS\system32\WindowsCodecs.dll
security.dll v5.1.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\security.dll
mscorsec.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorsec.dll
cryptnet.dll v5.131.2600.5512 (xpsp.080413-2113) - C:\WINDOWS\system32\cryptnet.dll
WINHTTP.dll v5.1.2600.5727 (xpsp_sp3_gdr.081215-1359) - C:\WINDOWS\system32\WINHTTP.dll
RibbonControlsLibrary.dll v3.5.31016.1 - C:\Documents and Settings\alo\Local Settings\Apps\2.0\0T7C18RW.YVA\MBJJL1EZ.1Y0\ilpm..xbap_49ec8f7eb5a8c36b_0001.0000_707d36ef42fba960\RibbonControlsLibrary.dll
WPFToolkit.dll v3.5.50211.1 - C:\Documents and Settings\alo\Local Settings\Apps\2.0\0T7C18RW.YVA\MBJJL1EZ.1Y0\ilpm..xbap_49ec8f7eb5a8c36b_0001.0000_707d36ef42fba960\WPFToolkit.dll
PresentationNative_v0300.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\system32\PresentationNative_v0300.dll
System.Windows.Controls.DataVisualization.Toolkit.dll v3.5.50211.1 - C:\Documents and Settings\alo\Local Settings\Apps\2.0\0T7C18RW.YVA\MBJJL1EZ.1Y0\ilpm..xbap_49ec8f7eb5a8c36b_0001.0000_707d36ef42fba960\System.Windows.Controls.DataVisualization.Toolkit.dll
System.Core.ni.dll v3.5.30729.1 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Core\349efab7d4325e3cf4bc57b8a1b0f605\System.Core.ni.dll
System.ServiceModel.ni.dll v3.0.4506.2152 (SP.030729-0100) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.ServiceModel\6546b83e8dc6bda9d61e2b969ac380f3\System.ServiceModel.ni.dll
ILPServiceClient.dll v1.0.0.0 - C:\Documents and Settings\alo\Local Settings\Apps\2.0\0T7C18RW.YVA\MBJJL1EZ.1Y0\ilpm..xbap_49ec8f7eb5a8c36b_0001.0000_707d36ef42fba960\ILPServiceClient.dll
SMDiagnostics.ni.dll v3.0.4506.2152 (SP.030729-0100) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\SMDiagnostics\79211ea9793c2a07bc28c7de65b2350f\SMDiagnostics.ni.dll
System.Runtime.Serialization.ni.dll v3.0.4506.2152 (SP.030729-0100) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Runtime.Seri#\7140256b1e3bf35d44a8dd98a4417252\System.Runtime.Serialization.ni.dll
System.Web.ni.dll v2.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.Web\7ab978a5d4256384ba0af0dc24198117\System.Web.ni.dll
System.WorkflowServices.ni.dll v3.5.594.1152 - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.WorkflowServ#\9c196402a2fb13fb2aa38af5443bfdbe\System.WorkflowServices.ni.dll
System.ServiceModel.Web.ni.dll v3.5.594.1152 - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.ServiceModel#\244eb842bea60d1f6cfdc18179187ec5\System.ServiceModel.Web.ni.dll
Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll v9.0.30729.1 - C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink\3.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll
System.IdentityModel.ni.dll v3.0.4506.2152 (SP.030729-0100) - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\System.IdentityModel\2899af558a530772289cb4b022ef8d59\System.IdentityModel.ni.dll
UIAutomationProvider.ni.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\UIAutomationProvider\fd23e35a951d31ea22e802cb811ec8d4\UIAutomationProvider.ni.dll
UIAutomationTypes.ni.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\NativeImages_v2.0.50727_32\UIAutomationTypes\d3636894f6b04b5abf405f2505f2ee07\UIAutomationTypes.ni.dll
PresentationFramework.dll v3.0.6920.1427 built by: SP - C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework\3.0.0.0__31bf3856ad364e35\PresentationFramework.dll
diasymreader.dll v8.0.50727.3053 (netfxsp.050727-3000) - C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll

Apr 21, 2010 at 11:10 PM

I was able to get around this by making my application Full Trust for the time being, but it seems like a bit much that WPF Toolkit demands that it be run in Full Trust.  Do people not make Partial Trust applications?

May 27, 2010 at 6:18 PM
I also get this error.
Jun 10, 2010 at 2:59 PM

I'm not sure that MS guys read discussions. Please, someone who can reproduce that, post it to their issue tracker as an issue.

Aug 5, 2010 at 9:03 PM
Edited Aug 5, 2010 at 9:06 PM

Hello All,

     Call me a Microsoft hater if you want, but I do not think Microsoft cares to resolve this issue since .NET 4 came out and they whole sale coppied the VisualStateManager code implementation into their core WPF framework.  The reason why this *wont* work is because the WPFToolKit.dll is not registered in the GAC and/or the application is not fully trusted.  A simple work around would be for them to put a Try, Catch block around the both PresentationSource.FromVisual calls in their "ShouldRunStateStoryboard" method. (See http://wpf.codeplex.com/workitem/13836).  Now I tried to compile my own flavor of WPFToolKit project, but I get a "WPFToolKit.dll" is expected to be loaded into the GAC error.  =( 

     The plain truth is that it is not "economically feasible" for them to correct issues like this since it would be better if we just use Silverlight as an alternative.  =((  But that is just this business professional's opinion.  Why do I think this?  Well for one, you can't seem to find the VisualStudio 2008 or .NET 3.5 connect.microsoft.com sites to start with and 2, no Microsoft or MVP personnel has even posted a response.  Perhaps I'm wrong; I hope I am.  Please feel free to disagree with me MVP(s), Microsoft, anyone, ect. 

- Rashad Rivera
  OmegusPrime.com

Connect Posting for our issue: https://connect.microsoft.com/VisualStudio/feedback/details/583702/shouldrunstatestoryboard-needs-try-catch-statement-block#tabs

Aug 6, 2010 at 4:37 PM

Well folks,

   Just like I said, Microsoft closed the connect ticket I submitted in one day saying: "we are no longer accepting bugs for Microsoft Visual Studio 2008".  I don't know, maybe they did not read this discussion. 

In any case, perhaps we can come up with our own solution.  I changed the code in the ShouldRunStatesStoryboard to the following:

private static bool ShouldRunStateStoryboard(FrameworkElement control, FrameworkElement stateGroupsRoot, VisualState state, VisualStateGroup group) {
	bool controlInTree = true;
	bool stateGroupsRootInTree = true;

	// We cannot simply check control.IsLoaded because the control may not be in the visual tree
	// even though IsLoaded is true.  Instead we will check that it can find a PresentationSource
	// which would tell us it's in the visual tree.
	if (control != null) {
		// If it's visible then it's in the visual tree, so we don't even have to look for a 
		// PresentationSource
		if (!control.IsVisible) {
			try {
				controlInTree = (PresentationSource.FromVisual(control) != null);
			} catch (System.Security.SecurityException) {
				// did not have a disirable affect, lets try
				// leaving it as true
				//controlInTree = false;
			}
		}
	}

	if (stateGroupsRoot != null) {
		if (!stateGroupsRoot.IsVisible) {
			try {
				stateGroupsRootInTree = (PresentationSource.FromVisual(stateGroupsRoot) != null);
			} catch (System.Security.SecurityException) {
				// did not have a disirable affect, lets try
				// leaving it as true
				//stateGroupsRootInTree = false;
			}
		}
	}

	return (controlInTree && stateGroupsRootInTree && (state == group.CurrentState));
}

I would love some suggestions from people to get it to work like it should.  Please reply back if you come up with another solution...  I hate to have to redevelop their code just to fix a silly issue like this SecurityException.  =}
- Rashad Rivera
OmegusPrime.com