Re: CAS,Stackwalk and code reuse



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



.



Relevant Pages

  • Re: Interesting NLHE hand in SnG this morning
    ... Interesting assertion, and one which I disagree with profoundly. ... I play the same Party games as you. ... chip stack on proportion to the blinds, ... and AA again to wipe out the third place player. ...
    (rec.gambling.poker)
  • Re: Debug Assertion Failed
    ... Add your command handler code here ... When you get an assertion error, make sure you are running under the ... If you look at the call stack between your code and where the ...
    (microsoft.public.vc.mfc)
  • Re: Debug Assertion Failed
    ... when i create a new second form and add in FileOnPrint and FileOnPrintPreview command from the MFC classwizard. ... When you get an assertion error, make sure you are running under the debugger and look at what the assertion says. ... If you look at the call stack between your code and where the assertion happens then you may see what has gone wrong. ...
    (microsoft.public.vc.mfc)
  • Re: List Control
    ... Thanks agian ... > assertion occurs the debugger stack window will show you who called ... If you have the MFC source ...
    (microsoft.public.vc.mfc)