Troubleshooting and Debugging Microsoft Dynamics 365 Business Central in a SaaS Environment

 

Introduction: The Importance of Troubleshooting in Business Central SaaS Environments

  • [00:28 ~ 02:25] This chapter focuses on troubleshooting Microsoft Dynamics 365 Business Central in a Software as a Service (SaaS) environment, emphasizing tools and techniques to diagnose and resolve issues efficiently.
  • The session is led by experts Kalman Perez and Nikolai Dobrev, marking their first joint presentation on this critical topic.
  • Key vocabulary and concepts introduced include telemetryin-client toolssnapshot debuggingprofiling, and database performance analysis. These form the foundation of troubleshooting in cloud-hosted Business Central environments and are essential for administrators and developers aiming to maintain robust system performance and reliability.
  • The significance lies in the growing use of Business Central SaaS by enterprises globally, where seamless troubleshooting directly impacts user experience, system uptime, and developer productivity.

Section 1: Telemetry and Its Role in Troubleshooting

  • [02:52 ~ 04:41] Telemetry is presented as the cornerstone for understanding system behavior in SaaS environments. It captures event data and operational metrics across Business Central tenants.
  • Although a detailed session is scheduled separately, telemetry allows users to gather information about system events and performance metrics remotely.
  • Power BI app has been introduced in the latest release to visualize telemetry data, making it easier to interpret complex information through dashboards.
  • Telemetry is essential for proactive troubleshooting, enabling administrators to identify issues before they impact end users.

Section 2: In-Client Troubleshooting Tools – Connectivity and Diagnostics

  • [04:05 ~ 07:07] Beyond telemetry, Business Central’s in-client tools offer powerful diagnostics directly accessible via the web client interface.
  • connectivity check tool verifies the communication status between the user’s browser and the Business Central tenant, diagnosing issues like login failures or CDN outages.
  • The connectivity check is accessible by appending /connectivity to the tenant URL or environment-specific URLs, providing immediate diagnostic feedback.
  • The Help and Support page within the client consolidates troubleshooting resources such as:
    • Last known errors
    • Known issues database
    • Page inspection tools
    • Performance analysis via the in-client profiler
    • Report problem feature to collect metadata and session IDs
  • A crucial tip is to always note the server session ID, as it aids in correlating client-side issues with backend logs.

Section 3: Page Inspector and Extension Impact Analysis

  • [06:33 ~ 08:49] The Page Inspector tool reveals detailed metadata about pages, including:
    • Table fields and their originating extensions
    • Active page filters
    • Performance contributions (timing) of each extension on page load
  • Extensions can be analyzed for their behavior; for example, a custom extension may introduce actions that cause errors or hangs.
  • An illustrative scenario shows an extension with two actions: one benign (“prepare press”) and one problematic (“do harm”), demonstrating how to detect the root cause of page malfunctions.
  • This diagnostic approach helps isolate custom code causing performance degradation or functional errors.

Section 4: Database Analysis – Logs, Locks, and Missing Indexes

  • [08:14 ~ 11:30] Database interactions are critical in Business Central, and troubleshooting often involves analyzing:
    • Database logs to detect locks or blocked operations
    • Table information pages that provide statistics such as record counts, table sizes, and index sizes
    • Wait statistics pages which show how long the system waits for various database operations
  • A key feature is the missing indexes analyzer, which reviews query patterns and suggests indexes to improve query performance.
  • Example: In a test environment, no missing indexes were reported, but production environments often benefit significantly from these recommendations.
  • Database locks are especially important to monitor, as they can cause hangs or failures when multiple sessions attempt conflicting operations.

Section 5: Event Recording and Permissions Debugging

  • [10:51 ~ 13:41] When event subscribers fail to trigger, the Event Recorder tool aids debugging by capturing a chronological list of fired events during a user scenario.
  • The event recorder helps verify whether the expected event has fired, assisting developers in pinpointing why their code doesn’t execute as intended.
  • The Effective Permissions page enables granular inspection of user permissions on objects and permission sets, crucial when users encounter access or execution errors.
  • Troubleshooting scheduled tasks is possible through the Scheduled Tasks overview, showing background jobs’ recurrence, timeouts, and related object IDs.

Section 6: Reporting and Exporting Data for Analysis

  • [13:00 ~ 15:11] Business Central allows exporting report data without publishing reports via the request page and an “export to Excel” feature.
  • This capability enables troubleshooting of report data and layouts without affecting live reports, facilitating data validation and error isolation.

Section 7: Debugging Enhancements in Visual Studio Code

  • [14:28 ~ 18:23] Debugging in Business Central has been enhanced with:
    • Visibility into database locks during debugging frames, helping developers understand concurrency issues.
    • New settings to exclude temporary records or try functions from breakpoints, reducing noise during debugging sessions.
    • The ability to specify a startup company during debugging launch, streamlining multi-company development scenarios.
  • These improvements enhance developer productivity by providing more granular control and richer diagnostic data.

Section 8: Snapshot Debugging – A Non-Intrusive Debugging Alternative

  • [17:45 ~ 27:09] Snapshot debugging is introduced as a production-safe debugging tool, akin to a video recorder for the call stack rather than intrusive breakpoints.
  • It records stack frames and variables at predefined Snap Points, capturing the execution context without halting production workloads.
  • Workflow includes setting snap points in Visual Studio Code, starting the snapshot session, performing the scenario, stopping the session, and downloading a snapshot file for offline debugging.
  • Key configuration options include:
    • Specifying a session ID or user ID to attach to particular sessions
    • Adjusting snapshot verbosity to balance detail and file size
    • Defining profiling types to collect performance data alongside debugging info
  • Snap points differ from traditional breakpoints as they must be planned ahead, being the sole points where data is collected.
  • Limitations include a maximum session time of 10 minutes and user notifications when snapshot debugging occurs, ensuring security and transparency.
  • The snapshot file contains GDPR-compliant data, necessitating careful handling.
  • A live demo illustrated capturing an API error scenario, retrieving the snapshot, and using Visual Studio Code to navigate through snap points and evaluate variables, highlighting the power of this tool for production troubleshooting.
  • Snapshot debugging supports error-triggered stopping points even without explicit snap points, ensuring error contexts are captured.

Section 9: Profiling Techniques – Instrumentation and Sampling

  • [32:53 ~ 42:59] Profiling is essential for performance tuning; two major profiling techniques are discussed:
    • Instrumentation-based profiling: Introduced a year ago, it records complete stack frames and execution times of procedures, including full time (total execution including callees) and self time (execution exclusive of callees). It is detailed but resource-intensive and produces large files.
    • Sampling-based profiling: Introduced more recently, it periodically samples stack frames at intervals (default 100ms), providing a less intrusive overview with lower overhead but less complete data. It may miss some calls but is effective for general performance insights.
  • Profiling data is visualized in Visual Studio Code using a CPU profile editor based on Google’s Chromium output format, offering:
    • Top-down views showing call stacks and timings
    • Bottom-up views showing callees and callers for each function
    • Support for sorting and filtering using a simple query language to pinpoint performance bottlenecks
  • Profiles can also be viewed in third-party tools like Firefox Profiler or Chrome/Edge DevTools, though some Business Central-specific metadata might not be fully represented.
  • The in-client profiler remains the easiest tool for end users, providing quick insights. Developers seeking granular data should use Visual Studio Code with snapshot and sampling profiles.
  • Profiling helps identify slow operations and optimize Business Central applications by focusing effort on the most time-consuming code paths.

Conclusion: Key Takeaways and Implications for Business Central Troubleshooting

  • The session provides a comprehensive toolkit for troubleshooting Business Central SaaS environments, combining telemetry, in-client diagnostics, advanced debugging, and profiling.
  • Understanding telemetry and leveraging the Power BI app enables proactive monitoring and issue detection.
  • The in-client tools offer immediate, user-friendly diagnostics for connectivity, permissions, database health, and page performance.
  • Snapshot debugging emerges as a game-changing approach for production troubleshooting, balancing data richness with minimal impact on live systems.
  • Profiling techniques, both instrumentation and sampling, empower developers to optimize performance by revealing detailed execution patterns.
  • These tools collectively reduce downtime, improve developer efficiency, and enhance user experience in cloud-hosted Business Central deployments.
  • The ongoing evolution of these diagnostics reflects Microsoft’s commitment to supporting complex enterprise environments where rapid, precise troubleshooting is paramount.

Advanced Bullet-Point Notes Summary

  • Telemetry captures operational events and performance metrics; new Power BI app visualizes this data for better insights.
  • Connectivity check tool diagnoses network and login issues between browsers and Business Central tenants.
  • Help & Support page consolidates troubleshooting resources: error info, page inspection, profiling, metadata collection, session IDs.
  • Page Inspector reveals extension sources, applied filters, and extension performance contributions on pages.
  • Custom extensions can be analyzed for errors causing hangs or failures.
  • Database tools include logs for locks, table statistics, wait times, and missing index suggestions to improve query speed.
  • Event Recorder helps verify if subscribed events have fired during scenarios.
  • Effective Permissions page diagnoses user permission issues on objects and permission sets.
  • Scheduled Tasks overview shows background job details, including recurrence and timeouts.
  • Reports can be exported to Excel from request pages without publishing, aiding data troubleshooting.
  • Debugging enhancements include visibility of database locks during debug, options to exclude temporary records and try functions, and startup company selection.
  • Snapshot debugging records stack frames and variables non-intrusively on production; requires planning snap points; limited to 10-minute sessions; GDPR data caution.
  • Snapshot debugging workflow: set snap points → start session → perform scenario → stop session → download snapshot → debug offline.
  • Profiling via instrumentation (detailed, resource-heavy) and sampling (lighter, less complete) reveals execution times and bottlenecks.
  • Visual Studio Code CPU profile editor supports top-down and bottom-up views with filtering and source navigation.
  • Profiles can also be opened in Firefox Profiler or browser dev tools with some limitations.
  • In-client profiler is accessible to end users; Visual Studio Code profiling suits developers needing depth.
  • Overall, combined tools improve troubleshooting accuracy, reduce downtime, and enhance performance tuning for Business Central SaaS environments.

No comments:

Post a Comment