Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / VS Tools for Office / June 2006

Tip: Looking for answers? Try searching our database.

VSTO Outlook Addin calling assemblies that demand FULL trust

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mdpowers - 16 Jun 2006 17:14 GMT
We have developed an Outlook 2003 Addin using VSTO2005 that talks to a
SQL2005 database, and that uses a few custom Windows forms.  Everything works
fine ... on the machine on which it was developed.  However, as soon as we
deploy it to a non-development machine, we start getting exceptions with the
message:

"That assembly does not allow partially trusted callers."

After googling that message, I found that there is an assembly attribute
that can be applied, the "AllowPartiallyTrustedCallers" attribute.  However,
I have put this into all of our assemblies, and it still gets this exception
thrown.  

I have set the Code Access Security for all of the assemblies, including the
addin, to FullTrust; the addin runs when deployed to other machines.  It is
only when certain code is executed that these exceptions get thrown.  

Is there ANYTHING that can be done to make the CALLER, my addin, be
considered to be fully trusted???
Andy - 28 Jun 2006 18:57 GMT
I'm hitting this message as well, when trying to load one of my own
assemblies from the outlook project (the assembly is strongly named).

andy

> We have developed an Outlook 2003 Addin using VSTO2005 that talks to a
> SQL2005 database, and that uses a few custom Windows forms.  Everything works
[quoted text clipped - 15 lines]
> Is there ANYTHING that can be done to make the CALLER, my addin, be
> considered to be fully trusted???
mdpowers - 28 Jun 2006 19:21 GMT
Unfortunately, it looks like the called assembly is looking at the fact that
the addin, despite being strongly named, runs as an extension of Outlook ...
which is NOT managed code ... and decides that unmanaged code is not to be
trusted.

We ended up refactoring our addin ... it no longer calls the assembly that
demanded the full-trust caller.

It is frustrating that Outlook, in demanding that the addin run in
"full-trust" Code Access Security mode, is NOT trusted.

> I'm hitting this message as well, when trying to load one of my own
> assemblies from the outlook project (the assembly is strongly named).
[quoted text clipped - 20 lines]
> > Is there ANYTHING that can be done to make the CALLER, my addin, be
> > considered to be fully trusted???
Andy - 28 Jun 2006 20:44 GMT
Well, I don't think I'll be able to get around that restriction by
refactoring.

Did you have the oltloader.dll installed? (Or is it even needed?)  I
don't have it installed (nor do I know how to) but I'd like to see if
this would help solve my problem.

Andy

> Unfortunately, it looks like the called assembly is looking at the fact that
> the addin, despite being strongly named, runs as an extension of Outlook ...
[quoted text clipped - 6 lines]
> It is frustrating that Outlook, in demanding that the addin run in
> "full-trust" Code Access Security mode, is NOT trusted.
mdpowers - 28 Jun 2006 21:30 GMT
I'm not sure what "OltLoader.dll" is.  I have not run across it.  We did find
that the AddinLoader.dll that ships with VSTO2005 is NOT signed; we ended up
signing it and then installing our copy to our installation folder.

Do you know which DLL is demanding the full-trust caller?  In our case we
had to do some work to isolate which one it was; turns out it was in some UI
that we were able to move to a different process so that we are now OK.

You MAY be able to get around this if the assembly that is demanding the
full-trust callers can be updated to include the
"AllowPartiallyTrustedCallers" assembly attribute.  In our case, it did not
work, but it may in yours.  If you look up "AllowPartiallyTrustedCallers
Attribute" in the MSDN help, it will give you a list of NameSpaces that will
NOT allow partially trusted callers ... but ironically, my addin appears to
use a number of the ones on the list that do not allow partially trustd
callers, and yet works just fine.

> Well, I don't think I'll be able to get around that restriction by
> refactoring.
[quoted text clipped - 15 lines]
> > It is frustrating that Outlook, in demanding that the addin run in
> > "full-trust" Code Access Security mode, is NOT trusted.
Andy - 29 Jun 2006 13:27 GMT
Maybe that was the VSTO 2003 version of AddinLoader..

It turns out that my assembly WAS loading and actually executing some
code, but it was bombing when trying to get a section from a config
file which was handled by my own custom ConfigSectionHandler.  The call
that bombed was the
System.Configuration.ConfigurationManager.GetSection; I guess for some
reason it couldn't get back into my already loaded assembly...

Adding the AllowTrustedPartialCallers did turn out to work, and
fortunatly I only needed to add it to the assembly which contained my
own ConfigurationManager / ConfigSectionHandler.  All my other
assemblies seem to just operate with full trust (since they can access
AD, my database, etc.).

Thanks
Andy

> I'm not sure what "OltLoader.dll" is.  I have not run across it.  We did find
> that the AddinLoader.dll that ships with VSTO2005 is NOT signed; we ended up
[quoted text clipped - 12 lines]
> use a number of the ones on the list that do not allow partially trustd
> callers, and yet works just fine.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.