DNN PageLoadException with no stack trace - dotnetnuke

We have a custom module on a dnn page that throws a Page_Load_Exception but does not include a stack trace in the EventLog*. The exception occurs apparently before our module is loaded, and our module works fine in other environments.
Is there a setting somewhere the disables or enables getting stack traces?
Now, in development, if I force Page Load Exceptions, I do get a stack trace, but in trying to figure out why I looked at the DNN code and noticed this in PageBase.cs
protected override void OnError(EventArgs e)
{
base.OnError(e);
Exception exc = Server.GetLastError();
Logger.Fatal("An error has occurred while loading page.", exc);
From what I've read, there's evidently some cases in asp.net where Server.GetLastError() will return null. A technique for avoiding this is to deal with Server.GetLastError() in global.asax and then stash it for later use by pages. Do you think this could be a cause in DNN of us ultimately not getting a stack trace?

Just as one piece of information. The DNN log was not including the stack trace because the AddLog stored procedure was not updated. As one commentator wrote, you can check /portals/_default/Logs. There you'll see a bunch of files and have exceptions for the DNN log. In there was an exception for AddLog. Once we determined the table structures matched the upgrade, all we had to do was apply the new stored procedure.

Related

Logging CakePHP 3 exceptions to database

I'm developing an API which throws various exceptions on bad requests, internal errors, etc..
I'd like to log these exceptions to a log table I've built. I could do this above each throw, but I assume Cake has a way of consolidating this into a custom exception handler. I just can't figure it out from the documentation http://book.cakephp.org/3.0/en/development/errors.html
Can someone point me to a resource I've failed to find or throw me some sample code?
Edit: Preference is to log to file as well as database.
It's all there in the docs:
Logging Exceptions
Logging (read the whole chapter)
Creating Loggers (Log to DB, includes Example!)
Implementation of the logger from the book

Silverlight Exception Message is different on other machines

I am currently stuck with the following problem and running desperately out of ideas, any clues are welcome!
We are using a custom built framework that loads what we call "pages" on demand for the UI, each of these "pages" is a self contained Silverlight XAML that is loaded on demand via:
XamlReader.Load(somePageXamlFile)
It may happen that a part inside this xaml is outdated, so a try / catch block ensures that a XAMLParseException is caught and the respective error handled.
Our current error handling is heavily based on the message of the exception, e.g. we expect a message like this:
"The type 'someType' could not be found. [Line: x Position: y]"
-> we parse the message string and replace the essential xaml parts with custom logic to make it valid again and display info for administrators.
The problem:
Some test machines throw the same exception, but with a different message!
Errormessage there:
"Error 2502 An error has occured."
This breaks our "safety net" logic for this case and currently we can not figure out any reason for this.
Solutions or proposals are very welcome,
thanks in advance!
-Steve
After long and hard search we came down to the following: The clients and the development machines seem to have different versions of the Microsoft agcore.dll (development machines have 2 different version in different paths). As this is the core of the exception we suppose this is the reason for the different error message - we were unable to fix this issue however (we cannot be sure what dll our clients get during SL5 download...) therefore we decided to rewrite the whole code segment to not make use of the exception message text at all. Lesson learned.
Thanks for the feedback. -Steve

ImageVault fails to find Anonymous user

We are using Episerver and ImageVault and it has worked fine for a long time. Until recently when showing albums to public users stopped working for no apparent reason.
No code changes in our project or change to the surrounding server environment.
An exception is thrown when the IVFileList control databinds. The exception that is thrown is "the trust relationship between the primary domain and the trusted domain failed".
I have debugged the code and come to the conclusion that the reason for the exception is actually because episerver tries to find a user called "Anonymous" with the WindowsMemberShipProvider. I have included a simplified stack trace below (excluded several calls for readability). I starts of with the DataBind call which leads to a call to episervers multiplexprovider to find the user "Anonymous" this in turn leads to a call to the method TranslateToSids that throws the exception.
System.Security.Principal.NTAccount.TranslateToSids(...)
EPiServer.Security.MultiplexingMembershipProvider.FindMembershipUser("Anonymous")
ImageStoreNET.Developer.WebControls.IVFileListData.DataBind()
I found a workaround for this problem by creating an local account in the webserver and named it "Anonymous". And now it all works again! The TranslateToSids method no longer throws the exception and the album pictures are visible.
Does anyone have a theory why this account suddenly is needed? We never had one before as we can recall. Although the workaround works, it feels like a ugly solution to create a local account. It should be a more correct way of solving this. Any suggestions?

Debugging the application in .net

whenever an exception occurs,by default it creates an New object of exception class.
Is there a way to findout the how many exception objects are created in the application.
Or Is there anyway to put the breakpoint in the construtor of the exception class.
You can find out how many exceptions per second are happening in your app using VS profiling. Just launch a sampling profiler session from visual studio. See:
http://msdn.microsoft.com/en-us/library/ff647791.aspx
http://msdn.microsoft.com/en-us/library/kfhcywhs.aspx
http://msdn.microsoft.com/en-us/magazine/cc337887.aspx

How can I get details about a Silverlight code generation exception?

I'm getting the following error now when I build my Silverlight Business Application:
The code generator
'Microsoft.ServiceModel.DomainServices.Tools.CSharpCodeDomClientCodeGenerator'
encountered a fatal exception and
could not generate code for project
'C:\Software\ProjectPartCenterAdmin\Alpha\Latest
Version\ProjectPartCenterAdmin\ProjectPartCenterAdmin.csproj':
Exception has been thrown by the
target of an invocation.
I DID ABSOLUTELY NOTHING TO MY CODE since it last worked! All I did was a clean rebuild of the application. Is there a way to get the details on what the exception was? I am dead in the water until i can figure this out.
Oh, and by the way, I hate code generation! I've had endless problems with RIA Services and I'm trying my best to do things "the right way"; that is, no hacks.
Edit:
I've also been getting a similar warning:
The following exception occurred
creating the MEF composition
container:
Unable to load one or more
of the requested types. Retrieve the
LoaderExceptions property for more
information.
The default code
generator will be used.
I've been getting this for some time now, and have ignored it because the application seems to be working fine.
Also, when I remove my CustomValidation attributes the exception goes away. But the warnings do not.
First, you need to check if there were custom validation errors in the project. I had the same issue but when I realized that I had two validation result methods with the same name! and change it, the built was successfull.

Resources