We have moved!

You are currently looking at documentation for Umbraco 8 and older versions.
An automated guess is that docs.umbraco.com/umbraco-cms/reference/debugging/ could be the link to the new documentation for Umbraco 9 and newer versions.

    Debugging with SourceLink

    Microsoft & Visual Studio have introduced a new debugging technology called 'SourceLink' that enables source code debugging of certain .NET assemblies from NuGet. In version Umbraco 8.1+ this feature has been enabled to allow developers to step into the native Umbraco CMS source code.

    • Verify that VS Debugging option SourceLink checked & Just My Code option is unchecked

    Visual Studio 2019 Debug Settings for SourceLink

    You can find details from Microsoft about SourceLink here:

    • Create new 4.7.2 .NET Framework blank/empty website
    • Install latest UmbracoCMS 8.1+ Nuget Packages from Nuget.org
    • Create an IUserComposer or similar code in your new site/SLN that you want to F11/Step Into
    • Prompt should appear & the original source code file is fetched directly from GitHub
    • How far can you F11 aka Step Into & go down the rabbit hole of the Umbraco CMS source code?

    Visual Studio 2019 SourceLink dialog

    using Umbraco.Core;
    using Umbraco.Core.Composing;
    using Umbraco.Core.Services;
    
    namespace WebApplication23
    {
        public class MyComposer : IUserComposer
        {
            public void Compose(Composition composition)
            {
                composition.Components().Append<MyComponent>();
            }
        }
    
        public class MyComponent : IComponent
        {
            private IContentService _contentService;
    
            public MyComponent(IContentService contentService)
            {
                _contentService = contentService;
            }
    
            public void Initialize()
            {
                // Add break point & F11 into me
                var root = _contentService.GetRootContent();
    
                foreach(var item in root)
                {
                    // Add break point & F11 into me
                    var udi = item.GetUdi();
                    var foo = 5;
                }
            }
    
            public void Terminate()
            {
            }
        }
    }