Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Supply chain | Supply Chain Management, Commerce
Suggested answer

Debug C# dll for Small Package Shipment

(1) ShareShare
ReportReport
Posted on by 541

In Dynamics 365 Finance and Supply Chain I'm writing a new rate engine.  This involves creating a C# dll.

I would like to debug the execution of the dll.

Are there any instructions on how to do this?

My thoughts are that I'd start the Finance and Operations debugger and attach to iisexpress.  From that point on I assumed I somehow have to manually load the symbols for my custom dll and put a breakpoint.  I've tried this but so far I haven't managed to hit my breakpoint.

Any tips would be greatly appreciated.

  • nspiteri Profile Picture
    541 on at
    RE: Debug C# dll for Small Package Shipment

    it is basically debugging a C# library but the trick is that the SPS engine, in Tier 1 machines only looks for the dll in the ApplicationSuite binary folder - once I got that figured out, the rest was easy.

  • nspiteri Profile Picture
    541 on at
    RE: Debug C# dll for Small Package Shipment

    Hi Mack,

    apologies for not answering earlier.  I've been meaning to put up a blog post about this but I kept getting dragged in other matters.

    I'll put one up in my blog at some point but you probably can't wait till then, so here is the quick version.

    In your ratting engine c# project, - only for the Tier 1 machine, you have to copy the resulting dll into the ApplicationSuite\bin folder.  The tutorial will not mention this but if you debug the part where it tries to find the engine, you'll see that it only looks in the ApplicationSuite model.  Without this it won't run your engine

    Additionally you need to copy the pdb file and the dll (which has your debug symbols into your model's meta data bin folder.

    Once you do this it should be able to debug but if you're stuck drop me a line here or on linkedin and I'll try to give you a call (its been a while so memory is a bit fuzzy)

    This might help you - in the Post Build Events I added the following steps so that what I said above is done automatically:

    xcopy /R /Y "$(TargetDir)$(ProjectName).dll" "K:\AosService\PackagesLocalDirectory\MYRateEngine\bin\$(ProjectName).dll"
    
    xcopy /R /Y "$(TargetDir)$(ProjectName).pdb" "K:\AosService\PackagesLocalDirectory\MYRateEngine\bin\$(ProjectName).pdb"
    
    xcopy /R /Y "$(TargetDir)$(ProjectName).dll" "K:\AosService\PackagesLocalDirectory\ApplicationSuite\bin\$(ProjectName).dll"

  • Awaxx Profile Picture
    225 on at
    RE: Debug C# dll for Small Package Shipment

    its not about the SPS but about the method you shared for that thread

  • Martin Dráb Profile Picture
    232,871 Most Valuable Professional on at
    RE: Debug C# dll for Small Package Shipment

    Sorry, I know nothing about this  Small Parcel Shipment - it would be a question to Norbert.

    And if you want to discuss development/debugging of C# libraries used outside of the context of SPS, then you're in a wrong thread. In such a case, simply create a new thread and explain your particular problem there.

  • Awaxx Profile Picture
    225 on at
    RE: Debug C# dll for Small Package Shipment

    Hello goshoom 

    Do you have a step by step documentation or tutorial to do your method please ?

    Because i tried but its asked many details that i dont master.

    Thanksfully.

  • nspiteri Profile Picture
    541 on at
    RE: Debug C# dll for Small Package Shipment

    so I can confirm that by changing the location of the dll, I can finally debug.  Whew

  • nspiteri Profile Picture
    541 on at
    RE: Debug C# dll for Small Package Shipment

    It stands for Small Parcel Shipment (have a typo in the header) but it lets you consume a c# dll to build integrations with providers.  You specify the dll in the configuration screen under TMS.

    I made some progress - set up a breakpoint in the X++ code which looks for the dll and found out that it was looking for it in a different place then any of the docs specify - seems like to get it to find the dll it has to be copied the ApplicationSuite binaries (the other docs seem to suggest it can stay in your model or in the aoswebroot).

  • Martin Dráb Profile Picture
    232,871 Most Valuable Professional on at
    RE: Debug C# dll for Small Package Shipment

    Well, I don't even know what SPS is, therefore I can't comment on why it behaves differently. :-(

  • nspiteri Profile Picture
    541 on at
    RE: Debug C# dll for Small Package Shipment

    That's how I always remember doing it, but for SPS it doesn't seem to load the symbols.

    I've also configured the debug based on these instructions to see if it works:

    community.dynamics.com/.../debug-microsoft-assemblies

    (without doing the pdb stuff as I already have those).

    If you have any other suggestion its more than welcome.

  • Suggested answer
    Martin Dráb Profile Picture
    232,871 Most Valuable Professional on at
    RE: Debug C# dll for Small Package Shipment

    What I normally do is adding a C# project to the same solution where I have an X++ project using the C# library. I build the C# project and add a project reference from the X++ project.

    Then I put a breakpint to the C# code and run the code (either setting a startup object and running the project, or attaching the debugger to iisexpress. And that's it.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,120 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,871 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans