Assembly crashes when run from network location

G

Guest

I've created an assembly that, because of 3rd party controls, requires full
trust to run. This is no problem when running from the local harddrive, but
when the application is run from a network drive, the application crashes and
want's to send information to Microsoft.
To deal with this, I added code to demand PermissionState.Unrestricted
before any other code is executed. I also added a strong name to facilitate
giving full trust to the application when run from the local intranet.
This solution works like a charm on my computer. When run from the network
location, I receive a message informing me I do not have sufficient
permissions. Using the wizard in the Administrative Tools I can easily allow
my application to run from the network drive.
Content with myself I walk to a collegue to demonstrate the polite message.
I double click the app on the network drive and watch in horror how it
crashes and wants to send info to Microsoft. Searching for the configuration
wizard, I find that users without VS2005 don't get that tool.

My questions:
1. Why does my app crash in stead of displaying my messagebox? What have I
missed?
2. Is there a way to obtain the configuration wizard for framework 2.0
without VS2005? I don't want to change security settings myself, since the
app will mainly be run from the local drive. The wizard is a lot easier to
use for my users than caspol.



Used code (taken from the Sudoku sample on MSDN):
[STAThread]
static void Main()
{

if (HasFullTrust)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Forms...);
}
else
MessageBox.Show("Error...");
}

}

private static bool HasFullTrust
{
get
{
try
{
new PermissionSet(PermissionState.Unrestricted).Demand();
return true;
}
catch (SecurityException) {return false;}
}
}
 
G

Guest

Ok, I've found part of the problem.
The crash is caused because, for some reason, the referenced 3rd party
control crashes my app before the first line of code is executed. When I add
a Full trust CAS code group for the strong name of the 3rd party control, the
app functions as expected.
The reason my app returned a polite error message, whereas it just crashes
on my colleague’s machine, is that the 3rd party control is also present in
my CAG. I missed that the first time.
I still hope someone can tell me why the 3rd party control crashes my app
before a single line of code is executed. I prefer to show an error message
over the 'send info to Microsoft' dialog.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top