
Signature
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
> I don't know exactly what you're seeing with the TreeView, I don't
> normally use it
<snip>
> This is .NET 2, so it might have been changed from earlier versions - but
> I would think the TreeView couldn't possibly work in an environment where
> the UnmanagedCode permission is not granted.
That's what I thought, but not for the reason you gave. My original question
is answered on the page you posted, I understand the security a lot more.
However, you said:
> I saw that the TreeView does in fact have this line on its WndProc:
> [SecurityPermission(SecurityAction.LinkDemand,
> Flags=SecurityPermissionFlag.UnmanagedCode)]
Now that confused me. For two reasons... One, I don't understand why it's
needed - surely the treeview is pretty safe?! Two - does this mean my
planned ClickOnce application can't use the TreeView?
Where did you get that info from? Is it based on the beta2 and could it
change? Or was it from msdn? :(
Danny
Oliver Sturm - 30 Sep 2005 10:10 GMT
>That's what I thought, but not for the reason you gave. My original
>question is answered on the page you posted, I understand the security a
[quoted text clipped - 7 lines]
>needed - surely the treeview is pretty safe?! Two - does this mean my
>planned ClickOnce application can't use the TreeView?
Probably the TreeView is pretty safe, but apparently they didn't see this
as a valid reason to work around .NET code security - which I generally
find a good thing.
I haven't tried this and I also haven't used ClickOnce, apart from a
cursory test. But I think you can actually run ClickOnce applications that
require all kinds of permissions client side; what I meant was you'll have
to make sure you have these permissions because the TreeView certainly
seems to require them. To acquire the needed permissions, you'll need to
use a feature called "permission elevation". Here's a blog article with a
quick explanation:
http://blogs.msdn.com/shawnfa/archive/2003/11/14/57031.aspx
But you can also find a lot of other docs, also on MSDN, by googling for
"permission elevation".
>Where did you get that info from? Is it based on the beta2 and could it
>change? Or was it from msdn? :(
This information is based on beta 2 and I got it by looking at the sources
for the TreeView with Reflector.
Oliver Sturm

Signature
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
Danny Tuppeny - 30 Sep 2005 18:25 GMT
> But I think you can actually run ClickOnce applications that require all
> kinds of permissions client side; what I meant was you'll have to make
> sure you have these permissions because the TreeView certainly seems to
> require them. To acquire the needed permissions, you'll need to use a
> feature called "permission elevation". Here's a blog article with a quick
> explanation: http://blogs.msdn.com/shawnfa/archive/2003/11/14/57031.aspx
That's right, but your user would get a box (I hope) saying something like
"this app wants to do something dangerous. Please click no" if I want access
for unmanaged code. The ActiveX dialog doesn't seem to put people off, so
I'm hoping with ClickOnce it's a bit more obvious just what you're giving
permission for!
Besides, even if I *can* get it, I don't want a user to have to give my app
access to do "anything" just for a treeview :-(
Anyways, I'll wait for the final release, and try it :-)
> This information is based on beta 2 and I got it by looking at the sources
> for the TreeView with Reflector.
Excellent - I was sure there was something out there, but I googled and
couldn't find it! Reflector it is! (duh, how obvious is that!)
:-)