web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Wrappable True or False

(0) ShareShare
ReportReport
Posted on by 276

Hi team,

 

I heared from my colleague and searching exploring but couldn't find such option…

 

Could you please clarify whether there is any property or configuration in Visual Studio to explicitly set a method as Wrappable = True or False? I searched the method properties in Visual Studio.

 

Pls advise, thanks 

Categories:
  • Suggested answer
    Martin Dráb Profile Picture
    241,656 Most Valuable Professional on at

    Please read the documentation first, it's not very long: Attributes that make methods extensible.

     

    You'll see that some methods are wrappable (e.g. non-final public methods) and some not (such as private methods). You can also use Wrappable attribute to disable it for methods that are normally wrappable, e.g. you have a method that must be public and non-final, but you don't want people to extend it.

  • CU29091230-0 Profile Picture
    276 on at

    Thanks Martin for the response.

     

    I have gone through the link…

     

    What I understood,

     

    Wrappable = True → The method can be wrapped using CoC.


    Wrappable = False → The method cannot be wrapped using CoC.

     

    So, the “Wrappable controls whether a method can participate in CoC or not. 

    Public and protected methods are generally wrappable by default if they meet the CoC requirements. 

     

    If Microsoft wants to prevent a particular method from being wrapped, it can explicitly mark the method with [Wrappable(false)].

    What I guess.

     

    Is my assumption is correct?

     

    Pls advise, thanks 

     

     

     

     

     

  • Martin Dráb Profile Picture
    241,656 Most Valuable Professional on at

    Your statement “Wrappable controls whether a method can participate in CoC or not.” doesn't make much sense to me. That a method can be extended by CoC means that the method is wrappable. It's a name for the fact, not two things where one is controlled by the other one.

     

    And if you mean the Wrappable attribute, you're wrong. As explained above, if you create, say, a non-final public method, it's wrappable. You don't need the Wrappable attribute to make it so.

     

    You aren't fully correct in “Public and protected methods are generally wrappable” because, I as I keep repeating and is explained in the documentation, final methods aren't wrappable, even if they're public or protected.

     

    And note that the attribute can be used by anyone, not just Microsoft. Obviously, it's interesting only if you expect others extending your code, which applies primarily ISVs (besides Microsoft).

  • CU29091230-0 Profile Picture
    276 on at

    Hi all 

     

    Again I read the documents to understand 

     

    What understood…

     

     

     

     

    In D365FO, the Wrappable attribute (true/false) controls whether a method can be extended using the Chain of Command (CoC) pattern. If Wrappable = true, developers can wrap the method in extensions and must call next to preserve the chain. If Wrappable = false, the method cannot be wrapped.

     

    Wrappable true - 

    The method can be wrapped using CoC.Extenders can add logic before/after the base method.They must call next to continue execution of the chain.Applies to public and protected methods (unless marked final).

     

    Wrappable false

    The method cannot be wrapped.No CoC extension is possible.

     

    Public methods → These are accessible from anywhere in the application. If marked Wrappable = true, they can be extended using Chain of Command.

     

    Protected methods → These are accessible only within the class itself and its subclasses. They can also be wrapped if Wrappable = true.

     

     

    Final methods → Even if they are public or protected, if marked final, they cannot be extended or wrapped. The final keyword locks them down completely.

     

    Is am I correct?

     

    Pls advise, thanks 

  • Suggested answer
    Martin Dráb Profile Picture
    241,656 Most Valuable Professional on at

    Not at all! I thought I made it clear, but let me try to explain it once more.

     

    The attribute doesn't control whether a method is wrappable or not. Whether method can or cannot be wrapped is normally defined by its declaration. For example, (non-final) public methods can be extended, private methods cannot. No attribute is involved in this default behavior.

     

    Therefore you're wrong in saying that public and protected methods can be extended with CoC only if explicitly marked as wrappable by the developer.

     

    You can use the attribute to modify the default behavior, such as use [Wrappable(false)] to disable CoC on a method that would normally be wrappable or [Wrappable(true)] to allow wrapping of final methods.

  • Suggested answer
    Layan Jwei Profile Picture
    8,428 Super User 2026 Season 2 on at

    Hi @CU29091230-0 ,
     

    By default, public and protected methods support Chain of Command (CoC), without needing to explicitly specify [Wrappable(true)].

    However, if you add [Wrappable(false)] to a public or protected method, CoC will no longer be allowed on that method.
     

    For public and protected methods marked as final, CoC is not allowed by default, without needing to explicitly specify [Wrappable(false)]. However, you can enable CoC for these methods by adding [Wrappable(true)].
     

    Finally, private methods cannot be wrapped using CoC, even if you specify [Wrappable(true)].
     

    You can find more details in the official Microsoft documentation:

    https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/extensibility/method-wrapping-coc

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 266 Super User 2026 Season 2

#2
Aayush Tiwari Profile Picture

Aayush Tiwari 217

#3
Subra Profile Picture

Subra 164 Super User 2026 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans