ClickOnce .Exe runs briefly, then disappears

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My network-drive deployed Clickonce application worked for a while when
deployed onto the machine on which it was developed (it still works
fine on other machines). Now, when run (on the development machine),
the .exe instantiates briefly (I can see it in the task manager process
list), then just disappears (i.e. no longer in the task manager process
list) - no exceptions are raised. The bizarre thing is that if I copy
the entire name-mangled application folder (c:\document and
settings\...\local settings\Apps\2.0\... ) from its deployment
destination, and paste it somewhere else on the hard drive (c:\temp,
for example), the .exe works fine. The application is designated as a
full trust application (My Project -> Security), and I successfully
execute

Dim p As New
System.Security.PermissionSet(Security.Permissions.PermissionState.Unrestricted)
p.Demand()

early on in the code, so it doesn't appear to be a security issue. Any
ideas?
 
Depending on how where you're executing your unrestricted permission demand,
you may not actually be testing whether your application is fully trusted.
When Demand is called for a standard CAS permission, the stack frame in
which the method is called is not evaluated for the demanded permission.
(i.e.: The method from which you call Demand gets skipped over.) If you're
making the demand from your application's Main method, there won't be any
stack frame evaluated from your application's assembly, and the demand will
pass even if your assembly is not granted unrestricted permissions. To
ensure that at least one method from your assembly is included in the
demand, simply move the Demand call into another method that can be called
from your Main method. e.g.:

Sub Main()

DemandFullTrust()
'...

End Sub


Private Sub DemandFullTrust()

Dim p As New
System.Security.PermissionSet(Security.Permissions.PermissionState.Unrestricted)
p.Demand()

End Sub
 
Back
Top