Re: Strange permission issue with a UserControl
From: Nicole Calinoiu (calinoiu)
Date: Tue, 21 Dec 2004 09:00:33 -0500
Events cannot be directly declared within an assembly, so what exactly do
you mean by "it exposes a public event which declared in another assembly"?
Is only the delegate declared in the other assembly? Does the UserControl
implement an interface declared in the other assembly, and the interface
defines the event? Does the UserControl inherit from a base class defined
in the other assembly, and the base class defines the event? A combination
of the above? Something else entirely?
Also, would it be possible for you to provide the full exception details as
retrieved from a call to its ToString method?
"ejstembler" <email@example.com> wrote in message
> I'm encountering a strange permission issue with a custom UserControl...
> The UserControl is part of a WinForms project (exe), however it exposes a
> public event which declared in another assembly (dll). Nothing out of the
> ordinary there. A winform (FormMain) in the exe project contains the
> UserControl on it, and implements the event. In the event, I call another
> method which calls a stored procedure and displays a MessageBox if it
> If I call that method from any other method in the form (such as
> FormMain_Load) it works fine. If the method is called from the
> event it throws a SqlClientPermission error (which is never displayed) and
> then a UIPermission error when the MessageBox is attempted to be
> I'm assuming that the UserControl has less rights for some reason; but
> It's almost acting like it's treating it as though it's in another less
> trusted zone (such as Local Network, or Internet). Both the WinForm
> (exe) and the referenced assembly (dll) are on the local computer. Even
> if I
> grant FullTrust to all of the assemblies in question, the .Net run-time
> displays the security exception dialog.
> Any ideas?