Overview
While supporting DNN, at some point, you will need to request the log files to troubleshoot an error that is being displayed. Effectively analyzing these errors with the related stack traces will help you narrow down the issue and resolve the issue.
Introduction
What Is a Stack Trace?
A stack trace is essentially a way that an application can let you know where precisely an error has occurred. A stack trace will consist of the error (otherwise called an exception) and where the code this error occurred. Combining these two elements will assist you in narrowing down the issue.
Here is an example of what a stack trace looks like:
[RD0003FFF9C6F6][D:33][T:131][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.NullReferenceException: Object reference not set to an instance of an object.
at Dnn.PersonaBar.Pages.Components.PageUrlsController.AddUrlToList(List`1 tabs, Int32 portalId, Int32 id, PortalAliasInfo alias,
Locale urlLocale, String path, String queryString, Int32 statusCode, Boolean isSystem, FriendlyUrlSettings friendlyUrlSettings, Nullable`1 lastModifiedByUserId
at Dnn.PersonaBar.Pages.Components.PageUrlsController.GetSortedUrls(TabInfo tab, Int32 portalId, Lazy`1 locales, Int32 sortColumn, Boolean sortOrder, Boolean isSystem
at Dnn.PersonaBar.Pages.Components.PageUrlsController.GetPageUrls(TabInfo tab, Int32 portalId
at Dnn.PersonaBar.Pages.Components.PagesControllerImpl.GetPageSettings(Int32 pageId
at Evoq.PersonaBar.Pages.Services.EvoqPagesController.GetPageDetails(Int32 pageId
at lambda_method(Closure , Object , Object[]
The first thing you should see (at the top of the stack trace) is the error message, which is a null reference exception combined with the Server Name - RD0003FFF9C6F6.
[RD003FFF9C6F6][D:33][T:131][ERROR] DotNetNuke.Services.Exceptions.Exceptions - System.NullReffernecesException: Object reference not set to an instance of an object.
The lines below show the steps the application took to produce the null reference exception.
Reading and Analyzing the Stack Trace
By using the example above, you will attempt to narrow down why this exception is being displayed in the log files. This particular exception occurs when a user browses the page settings for a specific page.
- First, you can see the exact error message that is produced: System.NullReferenceException: Object reference not set to an instance of an object. This tells us that you are looking for one of the object references that is displaying as null.
You will see this when you try and access the property or method of a null object. It would be beneficial to google any exception you encounter to better understand why these exceptions occur in the first place.
- Second and most importantly, look below the error message for the last method the code executed before the exception was produced. In this case, the application stopped at Dnn.PersonaBar.Pages.Components.PageUrlsController.AddUrlToList and this method will be a great place to start to look at the code.
- Third, below this method would be other following methods, which show which methods that the application had to call to reach the
AddUrlToList
method.This should be important to look at if you want to fully understand why these methods were called in this order.
- It is vital to acknowledge which edition of DNN the method is in. Since you know that the Pages Persona Bar component is available in Platform and Evoq, it is safe to say you can find this method in the DNN platform repository as Evoq is built on top of Platform.
- Using the information above and knowing you need to look into the Platform repository, you can browse the DNN Github and search for
AddUrlToList
.
- You will then need to view the cs file and find the constructor for
AddUrlToList,
which will tell you what this method does when it is called and implemented in other parts of the code.
- From looking at the code of the constructor, it seems like it is adding the URL for tabs to a list with specific attributes such as an ID, Site Alias, path, etc., but you may need a bit more information to narrow down what exactly is going on.
- The next method below
AddUrlToList
in the stack trace isGetSortedUrls.
- After reading the constructor for
GetSortedUrls
, you can see that the code generally deals with interactions with the Portal Alias and has parameters that pass TabIDs and PortalIDs. This is a significant clue on where you will need to look in the database to find any corrupt data to resolve this error.
Implementing a Solution Devised from the Stack Trace
You now know the issue could be related to the Portal Alias and tabs, you will need to dive into any database tables that deal or interact with the Portal Alias and Tabs.
- First, you will need to look at the
PortalAlias
table. After doing a SELECT query on this table, check if there is anything strange from the results. Comparing the results with a default environment should help in this case.In this example, assume that you did not find anything out of the ordinary in this table.
- Next, check the
TabUrls
table. This table is solely responsible for the management of Tab URLs. By filtering the query down to the specificTabID
, you can view all the URLs that are related to this specific page.For this particular issue, you can see a list of URLs with a column
PortalAliasId
, which relates to our findings from analyzing the stack trace.
- You can now go back and compare this ID with the IDs found in the results from the
PortalAlias
query and see if there is any data that does not look correct compared to thePortalAliasID
that you found.
- Looking at the results, you can see that
PortalAliasID = 3
does not exist in thePortalAlias
table. The error was generated because the application could not find a validPortalAliasID
for that particular page.
The solution would be to either change the PortalAliasID
to a valid PortalAliasID
or change the field to NULL
as that is the default value (because if the value is null, it will default to the Primary Alias).
Using this particular train of thought and troubleshooting process, you will be able to effectively handle almost every issue.
Other Helpful Resources
- Reading a Stack Trace (Confluence Agent Only)
- Debug an Issue Using a Stack Trace and Visual Studio (Confluence Agent Only)
- Diagnose UI Issue Using Source Code (Confluence Agent Only)
Comments
0 comments
Please sign in to leave a comment.