Re: CAS,Stackwalk and code reuse
- From: "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com>
- Date: Wed, 22 Feb 2006 08:52:54 -0500
You will need to make the assertion inline in your method in order for it to
be on the correct stack frame. Are you always asserting the same
permission(s) or do the asserted permission sets differ between your various
methods?
<siddharthkhare@xxxxxxxxxxx> wrote in message
news:1140581740.132876.245620@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I have requirement where I have to elevate CAS just before i make a
call to a com+ server.
so it's like
Myfunction()
{
Statemen ts to elevate CAS
make com+ call
Statemen to revert CAS
}
Instead of duplication the code in all methods I though ..I will
extract out that code into two utility function ...and make it kook
like this
Myfunction()
{
ElevateCAS();
make com+ call
Rewvert();
}
This didl not work ...becuase by the time ElevateCAS(); completes it's
taken out of stack so ..Rewvert() throws an error.......I think that's
how it CAS work .It's evaluated for a stack walk and not for a thread..
YES/NO?
Now..what options I have if wnat to reuse the code instead of
duplicating in all places where ever I am making the com+ calls.
Possible solution..
1) delegates ...to mimic a single stack walk.....but I hoping there
might be a simpler solution
2)Macros..is it possible to write macros in c#
3)Code snipet now in VS 2005..but I am not sure if snipet work in
similar way as macros ...in other words ..if i chage the master copy
..my chages should take effect in all places where ever I am using
snipet...I don't think snipet work that way...?
Any Ideas..what's the best way to do it?
Thanks
Sidd
.
- Follow-Ups:
- Re: CAS,Stackwalk and code reuse
- From: siddharthkhare
- Re: CAS,Stackwalk and code reuse
- References:
- CAS,Stackwalk and code reuse
- From: siddharthkhare
- CAS,Stackwalk and code reuse
- Prev by Date: Re: Question about Authorization Manager
- Next by Date: Re: StrongNameIdentityPermission problem
- Previous by thread: CAS,Stackwalk and code reuse
- Next by thread: Re: CAS,Stackwalk and code reuse
- Index(es):
Relevant Pages
|