Posted By: leighsword | Jun 3rd, 2005 @ 12:08 PM
page 1 of 1
Comments: 12 | Views: 10843 | Downloads: 117
leighsword
leighsword
LeighSword
Download:Link for light Zip,ready for Office12 .(0 Bytes)

I wrote it for the smart phone in the early year (2004.06 ,now I am quit this game), so this code is ugly, but it does work.

Note: the managed code only for test.

bug report in this post.

Nice, but (I haven’t looked thought all the code yet, but from what I see) your program tries to open a file on the local system. This is fine, except that if it is running as a partially trusted app it will throw a security error. The way around this is to open an Open File Dialog box and use the get the stream, not the file name to open the file. Same thing with saving (only use the Save File Dialog).

Tensor
Tensor
Im in yr house upgrading yr family
leighsword wrote:
Programous wrote:

Nice, but (I haven’t looked thought all the code yet, but from what I see) your program tries to open a file on the local system. This is fine, except that if it is running as a partially trusted app it will throw a security error. The way around this is to open an Open File Dialog box and use the get the stream, not the file name to open the file. Same thing with saving (only use the Save File Dialog).


this bug is an OS bug, not mine, the bug also is out of our control, the OS should not allow users to running my app as a partially trusted app.



Does anyone else find this as hilarious as me?

BUG: Wont work unless run in full trust.
FIX: Run in full trust.

Sven Groot
Sven Groot
My name has 9 letters. Coincidence? I think not...
leighsword wrote:
the OS should not allow users to running my app as a partially trusted app.

You should demand the appropriate permissions at assembly level to prevent an app from being run with insufficient permissions. If you don't tell the OS what permissions you require, you can't really expect it to guess can you?

In this case, you need FileIOPermission, so you should do:
[assembly: FileIOPermission(SecurityAction.RequireMinimum, Unrestricted=true)]
leighsword wrote:
Programous wrote:

Nice, but (I haven’t looked thought all the code yet, but from what I see) your program tries to open a file on the local system. This is fine, except that if it is running as a partially trusted app it will throw a security error. The way around this is to open an Open File Dialog box and use the get the stream, not the file name to open the file. Same thing with saving (only use the Save File Dialog).


this bug is an OS bug, not mine, the bug also is out of our control, the OS should not allow users to running my app as a partially trusted app.



I’m going to have to disagree with you on that. The OS should (as it does) run anything downloaded from the net in partial trust unless explicitly told otherwise. And Sven Groot is right, if your app needs certain permissions to run it should declare them as such. But for 95% of desktop apps that need to access a file the GetStream method should be used so it can run as partially trusted. 
leighsword wrote:
Sven Groot wrote:
leighsword wrote: the OS should not allow users to running my app as a partially trusted app.

You should demand the appropriate permissions at assembly level to prevent an app from being run with insufficient permissions. If you don't tell the OS what permissions you require, you can't really expect it to guess can you?

In this case, you need FileIOPermission, so you should do:
[assembly: FileIOPermission(SecurityAction.RequireMinimum, Unrestricted=true)]

well,it's my mistake, this is not an OS bug,but it absolutely is an .Net framework bug, and i hope this bug will be fixed in .net 2.0 .

why we need to write extra statements to fix a MS bug in our apps,is it really need?
old chinese told us, '画蛇添足'.

画蛇添足 (hua4 she2 tian1 zu2)(draw+snake+add+foot)
  • Literally: adding legs when painting a snake
  • Moral: Don't overdo something.
  • English equivalent: to gild the lily


It’s not a glitch in the framework. It’s a security system. I don’t know about you, but I don’t want every program I run to have full access to my file system. Also, you don’t want your programs auto-declaring every statement that would cause an error. Because all a declaration says is if I don’t have permission, fail immediately. What if your program could do 99.99% of its tasks without the permission, and the part that needs is only used under some uses of your program; you would still want to be able to perform the other uses under a partially trusted environment.
page 1 of 1
Comments: 12 | Views: 10843 | Downloads: 117
Microsoft Communities