Difference between revisions of "HowTo:Debugging UBIK"
m (→A general policy for debugging) |
|||
Line 1: | Line 1: | ||
One of the most complex challenges when working on any software project is to debug unintended behavior. In {{UBIK}}, there is an inherent structure to every project, which we can exploit for debugging. Let's find out, how. | One of the most complex challenges when working on any software project is to debug unintended behavior. In {{UBIK}}, there is an inherent structure to every project, which we can exploit for debugging. Let's find out, how. | ||
+ | == Quick-fix check list == | ||
− | + | Many issues can be resolved by going through the following check list. | |
− | + | # Check settings and configurations for typos, missing entries and other errors | |
− | + | # Restart {{UBIK}} Studio and reconnect to your DB to avoid caching issues | |
− | # | + | # Check whether all plugins were loaded correctly |
− | + | # In case the custom code was changed, or {{UBIK}} was upgraded to a new version: | |
− | + | ## Compile and publish the customizing (F6) | |
− | + | ## Restart the Enterprise Service | |
− | + | ## Restart all Web Services | |
− | # | + | # In case the data model for the client was changed: |
− | + | ## Rebuild and publish the ACM meta definitions using the ACM manager | |
− | # | + | ## Restart all web services |
− | # | + | # Restart the {{UBIK}} client application to make sure new meta definitions and content are received |
− | + | ||
− | + | ||
− | ## | + | |
− | ## | + | |
− | ## | + | |
− | + | ||
− | + | ||
− | + | ||
− | # | + | |
− | # | + | |
− | ## | + | |
− | # | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | == A general policy for debugging == | |
− | + | Debugging can be approached methodically. Here's a basic plan for debugging software. | |
− | + | ||
+ | # '''Reproduction''': Get all available, relevant information about the bug and confirm the problem in a test setup | ||
+ | # '''Inspection''': Inspect the actual behavior to understand the cause | ||
+ | # '''Fix''': Design and implement a solution | ||
+ | # '''Retest''': Test the fix | ||
== Debugging {{UBIK}} == | == Debugging {{UBIK}} == | ||
− | |||
− | |||
− | |||
− | |||
<!-- DO NOT REMOVE THIS -->{{Template:HowTo/Begin}}<!-- DO NOT REMOVE THIS --> | <!-- DO NOT REMOVE THIS -->{{Template:HowTo/Begin}}<!-- DO NOT REMOVE THIS --> | ||
+ | = Reproduction = | ||
− | = | + | ==== Full Test System ==== |
− | + | To reproduce the problem with {{UBIK}}, you require a test setup. This usually means a local copy of the database the problem occurred with and an installation of the {{UBIK}} products relevant for the problem. It is important to use the same binaries, plugins and versions as in the system where the problem occurred. | |
+ | Then, we can try to provoke the reported issue in the test setup. This might require getting more information about the issue. | ||
− | + | ==== Isolation Testing ==== | |
+ | If a full test setup is not feasible, isolating a (presumably) faulty part and testing it individually often makes sense. | ||
− | + | In {{UBIK}} Studio, there are two tools for this: | |
+ | * Who-Bert Debugging Tool | ||
+ | * View Test Tool | ||
+ | |||
+ | Both can be used to test the behavior of {{UBIK}} objects (and custom code) on the server side. | ||
+ | With Who-Bert code and manually created test data, you can additionally set up a "mock" or "fake" situation, to test the behavior under very specific circumstances. | ||
+ | The View Test Tool simulates how the web service assembles data for the client, ignoring the ACM meta definitions (context, scopes etc.). | ||
+ | |||
+ | = Inspection = | ||
− | + | Once you have a test setup and are able to reproduce the issue, you can inspect what's happening in detail to find out why the problem occurs. | |
+ | This can be done either by debugging with Visual Studio, or by producing diagnostic output in the form of log entries, {{UBIK}} objects and property values, or UI customizing. | ||
+ | === Inspect the mobile client === | ||
+ | * Use the [[Developer_Mode]] to inspect the currently visible view models and their values. | ||
+ | * Inspect the log files of the mobile client, including the web service client log. | ||
+ | |||
+ | === Inspect the web services or the Enterprise Service === | ||
+ | * Inspect the log files of the web service or Enterprise Service. | ||
+ | * Modify your plugin or programmatic customizing to output log messages describing the state of your program at critical points. | ||
+ | * Modify your plugin or programmatic customizing to write diagnostic {{UBIK}} objects describing the state of your program at critical points. | ||
+ | * Use a Who-Bert script to test a specific setup and output log messages to the console. | ||
+ | |||
+ | = Hypothesizing = | ||
+ | In order to narrow down the cause of the problem, we can try to formulate an idea what could have gone wrong. Optimally, we actually go and look for a proof, to see it happen in action, but it's always good to know potential error sources. In general, there are several common types of problems, and from another perspective, a set of common sources for such problems. | ||
+ | |||
+ | === Visualizing the architecture and algorithm === | ||
+ | In order to come up with a good hypothesis, you must understand the architecture and algorithm at work. | ||
+ | This means you have to find out which {{UBIK}} products and modules are involved and how the affected use-case is implemented in the project. | ||
+ | [[File:IL_Platform_Architecture.png|thumb|The UBIK platform architecture]] | ||
Nearly all use-cases in {{UBIK}} projects are either related to the mobile client or to interfacing with 3rd party systems. Though the specific implementation can be very different from others, the general flow of information throughout {{UBIK}} modules will almost always be similar. If there is a problem, it has to occur in one of the respective steps, caused by one of the listed dependencies. | Nearly all use-cases in {{UBIK}} projects are either related to the mobile client or to interfacing with 3rd party systems. Though the specific implementation can be very different from others, the general flow of information throughout {{UBIK}} modules will almost always be similar. If there is a problem, it has to occur in one of the respective steps, caused by one of the listed dependencies. | ||
Line 101: | Line 113: | ||
In this case, the {{UBIK}} Proxy mechanism is an additional source of complexity; but there's a [[HowTo:Configure_Proxies|separate article]] for that. | In this case, the {{UBIK}} Proxy mechanism is an additional source of complexity; but there's a [[HowTo:Configure_Proxies|separate article]] for that. | ||
− | = | + | === Types of problems === |
− | |||
− | |||
− | |||
==== Performance issues ==== | ==== Performance issues ==== | ||
Performance issues can be caused by: | Performance issues can be caused by: | ||
Line 151: | Line 160: | ||
** Network security restriction | ** Network security restriction | ||
** User rights restriction | ** User rights restriction | ||
− | |||
− | |||
− | |||
− | |||
− | |||
* Web Service, Studio or Enterprise Service | * Web Service, Studio or Enterprise Service | ||
** A manual step was forgotten (rebuilding the custom code, releasing the ACM meta definitions, restarting the web service, ...) | ** A manual step was forgotten (rebuilding the custom code, releasing the ACM meta definitions, restarting the web service, ...) | ||
Line 162: | Line 166: | ||
** Plugin code (a standard or customer plugin has a bug) | ** Plugin code (a standard or customer plugin has a bug) | ||
** Custom code (custom code of meta classes or the custom code library has a bug) | ** Custom code (custom code of meta classes or the custom code library has a bug) | ||
+ | * Client App | ||
+ | ** Erroneous data (unexpected values provoke the problem) | ||
+ | ** Wrong configuration (the profile or a configuration object coming from the server is misconfigured) | ||
+ | ** UI customizing (some XAML contains an error) | ||
+ | ** Core implementation (the app itself has a bug) | ||
− | = | + | = Fix: Performance Problems = |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
If you're in the technical design stage, you've already found out the reason for the performance issues. In case of a hardware or infrastructure bottle neck, you can either try to get better circumstances - or adapt to them, optimizing your solution. | If you're in the technical design stage, you've already found out the reason for the performance issues. In case of a hardware or infrastructure bottle neck, you can either try to get better circumstances - or adapt to them, optimizing your solution. | ||
Line 239: | Line 229: | ||
Anyway, in some cases the use-case can be rearranged so the amount of data and information presented to the user at one point in time is smaller. | Anyway, in some cases the use-case can be rearranged so the amount of data and information presented to the user at one point in time is smaller. | ||
− | = | + | = Fix: Crashes = |
As explained in the hypothesizing section, crashes usually happen because of an unhandled exception being thrown by some module. | As explained in the hypothesizing section, crashes usually happen because of an unhandled exception being thrown by some module. | ||
Line 249: | Line 239: | ||
The real problem is either that the situation shouldn't occur in the first place or that the program cannot deal with that case; maybe it's a buggy dependency or erroneous input data. | The real problem is either that the situation shouldn't occur in the first place or that the program cannot deal with that case; maybe it's a buggy dependency or erroneous input data. | ||
− | = | + | = Fix: Faulty data = |
For faulty data, we have to find out where it comes from and solve the problem at its source (or as close to it as possible). | For faulty data, we have to find out where it comes from and solve the problem at its source (or as close to it as possible). | ||
Line 259: | Line 249: | ||
The rule of thumb here is: Don't try to cope with the faulty data when processing or showing it. Instead, fix the problem at the source and repair the data by reimporting. | The rule of thumb here is: Don't try to cope with the faulty data when processing or showing it. Instead, fix the problem at the source and repair the data by reimporting. | ||
− | = | + | = Fix: Other misbehavior = |
Maybe the issue is a simple typo or wrong setting and you can fix the problem with a simple measure. Since you're reading this, the solution might not be so simple and we have to approach it conceptually. | Maybe the issue is a simple typo or wrong setting and you can fix the problem with a simple measure. Since you're reading this, the solution might not be so simple and we have to approach it conceptually. |
Revision as of 13:24, 15 February 2024
One of the most complex challenges when working on any software project is to debug unintended behavior. In UBIK®, there is an inherent structure to every project, which we can exploit for debugging. Let's find out, how.
Quick-fix check list
Many issues can be resolved by going through the following check list.
- Check settings and configurations for typos, missing entries and other errors
- Restart UBIK® Studio and reconnect to your DB to avoid caching issues
- Check whether all plugins were loaded correctly
- In case the custom code was changed, or UBIK® was upgraded to a new version:
- Compile and publish the customizing (F6)
- Restart the Enterprise Service
- Restart all Web Services
- In case the data model for the client was changed:
- Rebuild and publish the ACM meta definitions using the ACM manager
- Restart all web services
- Restart the UBIK® client application to make sure new meta definitions and content are received
A general policy for debugging
Debugging can be approached methodically. Here's a basic plan for debugging software.
- Reproduction: Get all available, relevant information about the bug and confirm the problem in a test setup
- Inspection: Inspect the actual behavior to understand the cause
- Fix: Design and implement a solution
- Retest: Test the fix