Windows Develop Bookmark and Share   
 index > ClickOnce and Setup & Deployment Projects > I'm getting "that assembly does not allow partially trusted callers" when I run my app?
 

I'm getting "that assembly does not allow partially trusted callers" when I run my app?

Please I'm trying to use ClickOnce deployment for a windows application. The windows application is assigned with a strong name.

The zone of the application in the security setting is local internet and the (This is a partial trust application) check is selected.

I did ran the calculate permissions option and I include all of the permissions but I'm still getting the error message when I try to run the application within the VS 2008 IDE environment.

I don't know why I'm getting this message? Or how I can resolve this problem?

Please I need your help.

Thank you.

Sami2020  Saturday, September 19, 2009 12:29 AM
Do the Telerik controls that you are using require you to be running as a full trust application? If you set it to be full-trust, does it work?

If you look at the stack dump, it looks like it ends up in the Telerik controls doing some kind of COM stuff. Maybe you need full trust to do that.

RobinDotNet
Click here to visit my ClickOnce blog!
  • Marked As Answer bySami2020 Sunday, September 20, 2009 7:20 PM
  •  
RobinDotNet  Sunday, September 20, 2009 6:16 PM
No, it won't. ClickOnce applications never require administrative privileges in order to install. They are placed under the user's profile folders, where in most environments he has complete access. (I say "most" because some corporations try to lock those down.)

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Sunday, September 20, 2009 7:00 PM

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Security.SecurityException: That assembly does not allow partially trusted callers.
at System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.InternalCreateInstanceWithNoMemberAccessCheck(Type type, Boolean nonPublic)
at System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr ptr, Type structureType)
at Telerik.WinControls.UI.ThemedFormBehavior.OnWMGetMinMaxInfo(Message& m)
at Telerik.WinControls.UI.ThemedFormBehavior.HandleWndProc(Message& m)
at Telerik.WinControls.UI.RadFormBehavior.HandleWndProc(Message& m)
at Telerik.WinControls.UI.RadFormControlBase.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
The action that failed was:
LinkDemand


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Microsoft.VisualStudio.HostingProcess.Utilities
Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.1
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.HostingProcess.Utilities/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.HostingProcess.Utilities.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualStudio.HostingProcess.Utilities.Sync
Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.1
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.HostingProcess.Utilities.Sync/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll
----------------------------------------
Microsoft.VisualStudio.Debugger.Runtime
Assembly Version: 9.0.0.0
Win32 Version: 9.0.21022.8
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualStudio.Debugger.Runtime/9.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualStudio.Debugger.Runtime.dll
----------------------------------------
vshost
Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.1
CodeBase: file:///D:/Projects/Juva/Source/JuvaClient/bin/Debug/JuvaClient.vshost.exe
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Deployment
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Deployment/2.0.0.0__b03f5f7f11d50a3a/System.Deployment.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Core
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml.Linq
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml.Linq/3.5.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
System.Data.DataSetExtensions
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Data.DataSetExtensions/3.5.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll
----------------------------------------
Telerik.WinControls
Assembly Version: 2009.2.9.729
Win32 Version: 2009.2.9.729
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Telerik.WinControls/2009.2.9.729__5bb2a467cbec794e/Telerik.WinControls.dll
----------------------------------------
Telerik.WinControls.UI
Assembly Version: 2009.2.9.729
Win32 Version: 2009.2.9.729
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Telerik.WinControls.UI/2009.2.9.729__5bb2a467cbec794e/Telerik.WinControls.UI.dll
----------------------------------------
Telerik.WinControls.Themes.Aqua
Assembly Version: 2009.2.9.729
Win32 Version: 2009.2.9.729
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Telerik.WinControls.Themes.Aqua/2009.2.9.729__5bb2a467cbec794e/Telerik.WinControls.Themes.Aqua.dll
----------------------------------------
Telerik.WinControls.Themes.Vista
Assembly Version: 2009.2.9.729
Win32 Version: 2009.2.9.729
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Telerik.WinControls.Themes.Vista/2009.2.9.729__5bb2a467cbec794e/Telerik.WinControls.Themes.Vista.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
JuvaClient
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///D:/Projects/Juva/Source/JuvaClient/bin/Debug/JuvaClient.EXE
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
TelerikCommon
Assembly Version: 2009.2.9.729
Win32 Version: 2009.2.9.729
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/TelerikCommon/2009.2.9.729__5bb2a467cbec794e/TelerikCommon.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Sami2020  Saturday, September 19, 2009 12:49 AM
Do the Telerik controls that you are using require you to be running as a full trust application? If you set it to be full-trust, does it work?

If you look at the stack dump, it looks like it ends up in the Telerik controls doing some kind of COM stuff. Maybe you need full trust to do that.

RobinDotNet
Click here to visit my ClickOnce blog!
  • Marked As Answer bySami2020 Sunday, September 20, 2009 7:20 PM
  •  
RobinDotNet  Sunday, September 20, 2009 6:16 PM

Please I'm new to the ClickOnce deployment and I need to know if I change the setting of the ClickOnce deployment to full trust is that will require administration rights for the end user in order to install the application?

Sami2020  Sunday, September 20, 2009 6:57 PM
No, it won't. ClickOnce applications never require administrative privileges in order to install. They are placed under the user's profile folders, where in most environments he has complete access. (I say "most" because some corporations try to lock those down.)

RobinDotNet
Click here to visit my ClickOnce blog!
RobinDotNet  Sunday, September 20, 2009 7:00 PM

Please what is the deference between full trust and partial trust from the deployment point of view?

Sami2020  Sunday, September 20, 2009 7:04 PM
I changed it to full trust and it works. thank you
Sami2020  Sunday, September 20, 2009 7:19 PM
You're welcome. It's not different in terms of deployment, but in terms of what the application can do when it runs.

I've never used partial trust myself, but here's an example: The default for partial trust is the local intranet zone. When you mark the application as partial trust, the default working directory is the .NET Framework folder under C:\Windows\. If you try to open a Streamwriter object, by default it tries to create a file in the working directory, and because the local Intranet Zone permissions do not include that permission, you won't be able to.

(Frankly, I think it's a p.i.t.a., although I'm sure someone has found a need for partial-trust.)

RobinDotNet


Click here to visit my ClickOnce blog!
RobinDotNet  Sunday, September 20, 2009 7:34 PM

I really appreciated the information and help. Thanks again.

Sami2020  Sunday, September 20, 2009 7:41 PM
Sami,

As Robin pointed out the root cause, if you wanted to know more about how things work with "partial trust", you can get more information here:Code Access Security. There is a section called "Using Libraries from Partially Trusted Code" which I think describes the exact problem you faced.

Regards,
Jie
MSDN Subscriber Support in Forum
If you have any feedback on our support, please contact msdnmg@microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

If you have any feedback, please tell us.

The CodeFx Project
My Blog (in Simplified Chinese)
Wang, Jie  Monday, September 21, 2009 7:20 AM

You can use google to search for other answers

Custom Search

More Threads

• can I add shortcuts to start/programs/myApp with ClickOnce?
• ClickOnce Only One Version
• Autostart
• Custom Action during Setp to install 3rd party App
• Using BITS to Update your application automatically issues?
• Click Once overhead?
• Exclude Filters Overwritten on Detected Dependencies when Re-Opening Project
• How do I create a Custom Action to run BEFORE uninstalling?
• Embedded Manifest Entry Gone
• Outlook application