These same attributes can be added into the IL code to hide the Macro1 method from debugging and from intellisense and object browser:
Start with the original IL code for Macro1:
.method public hidebysig instance void Macro1() cil managed
{
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method AppAddIn::Macro1
Open the IL file in any text editor, and then add the following ".custom" lines:
.method public hidebysig instance void Macro1() cil managed
{
.custom instance void [mscorlib]System.Diagnostics.DebuggerNonUserCodeAttribute::.ctor() = ( 01 00 00 00 )
.custom instance void [System]System.ComponentModel.EditorBrowsableAttribute::.ctor(valuetype [System]System.ComponentModel.EditorBrowsableState) = ( 01 00 01 00 00 00 00 00 )
// Code size 2 (0x2)
.maxstack 8
IL_0000: nop
IL_0001: ret
} // end of method AppAddIn::Macro11
These '.custom' attributes added to the IL code will hide the Macro1 method from debugging, from intellisense and from object browser.
Posted
May 26 2009, 01:34 PM
by
BillL