[RESOLVED] program wont work on any other computer
Argh! I finally finished my program and it works just fine on my computer, but when I tried to show it on a different computer it wouldn't even start up, but gave an unhandled System.Security.Policy.PolicyException message to me. I ran the program in an earlier phase of development and it would run on it. I have no idea what I've added since then to the program that has made this error to appear. I'm tryin to think of anything I have goin on, here's a small list of the main stuff I'm using:
System::IO::Directory/DirectoryInfo
System::IO::File/FileInfo
Filestream, Streamwriter/reader, Binarywriter/reader
The program is a simple Windows Forms program used as an Inventory database.
The only problem with the classes that I've listed is that I already was using them when it did work.
Do yall have any idea what might be wrong?
Thanks,
David
[915 byte] By [
davidguygc] at [2007-11-19 22:48:22]

# 1 Re: [RESOLVED] program wont work on any other computer
System::IO::Directory/DirectoryInfo
That is suppose to be System::IO:: Directory/Directory info lol.
# 2 Re: [RESOLVED] program wont work on any other computer
"This exception is typically thrown when the code requests more permissions than the policy will grant or the policy is configured to prohibit running the code.
PolicyException uses the HRESULT CORSEC_E_POLICY_EXCEPTION."
-- from the HELP section of the .NET IDE.
First, let me preface my remark by mentioning that I have ZERO experience chasing down Policy Exceptions, consequently, I may be way off base in making any suggestion, but if I faced this problem, I'd be inclined to attempt to catch the exception, then use the exception argument to interrogate the exception properties such as "TargetSite" and/or "Source".
This might allow me to identify the source of the exception, and that might indicate which policy has been violated ... this may very well be a permissions violation wherein the application/user doesn't have the requisite permission to use a resource or run an application on the problem machine.
I would think that identifying the source would be a good first step, and a good way to identify the source is to catch the exception.
Does the default message identify the source? Does it provide a stack trace? That alone may be enough to identify the source.
It may be necesary to get involved with Role-based procedures or to grant privileges to the application/user.
Again, take any suggestion I make with a grain of salt ... I have no experience with this problem, and thus have no idea what I'm talking about.
Good Luck.
bill
# 3 Re: [RESOLVED] program wont work on any other computer
I am not sure where the problem is happening on the computer because I don't have a debugger installed on that computer. I can try to run the program remotely on mine, and thats how I find out the exception name, it won't tell me where specifically in the program that the exception is being thrown.
I'm going to try to somehow find a way to link the source code to the program thats on the other computer. I'm still very open to any help yall might have, I'm running around in the dark on this one.
Thanks,
David
# 4 Re: [RESOLVED] program wont work on any other computer
I just don't understand how come I can run this program just fine on my computer, but when I move it to another computer it freaks out. I put it onto my laptop that visual studio 2003 on it, and when I ran the debugger it came up with a System.NullReferenceException. What could I possibly have done that makes it to where I can only run it on my computer?
# 5 Re: [RESOLVED] program wont work on any other computer
I figured it out! The System.Security.Policy.PolicyException is from me trying to run the program on my computer while it was on the other computers HD, and it freaked out over the FileStream being involved with that.
The answer had nothing to do with my program, I had changed around setup of my savefile, and it was trying to read the old version.
Thanks for yalls help
David