Showing posts with label debug. Show all posts
Showing posts with label debug. Show all posts

Monday, November 8, 2010

WCF exception PlainXmlWriter+MaxSizeExceededException

When logging and tracing are switched on for a WCF service, the following exception might be thrown

A message was not logged.
Exception: System.InvalidOperationException: There was an error generating the XML document. ---> System.ServiceModel.Diagnostics.PlainXmlWriter+MaxSizeExceededException: Exception of type 'System.ServiceModel.Diagnostics.PlainXmlWriter+MaxSizeExceededException' was thrown.
The reason is that the maxSizeOfMessageToLog configuration parameter is set to a value that is lower than the size of the message that was trying to be logged.

<system.servicemodel>
<diagnostics>
<messagelogging logentiremessage="true" logmalformedmessages="true" logmessagesatservicelevel="true" logmessagesattransportlevel="true" maxmessagestolog="30000" maxSizeOfMessageToLog="200000">
</diagnostics>
</system.servicemodel>
And while on the subject, it can be worth checking out the MSDN recommended settings for tracing and message logging at http://msdn.microsoft.com/en-us/library/aa702726.aspx.

Thursday, August 5, 2010

Visual Studio hangs after debugging

I have repeatedly since I started working in Visual Studio 2008 been swearing while debugging applications since the whole IDE stops responding for a while when stopping the debug session. No updates, service packs or changes to the preferences has been able to stop this behaviour. I've also seen it on numerous other machines and have never been able to figure out why this is happening.

Yesterday I started investigating the issue again and stumbled upon a discussion I've missed before: http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/e9c5da47-a194-4051-a3d5-28b404263b3f

In this discussion, the problem is both found and solutions offered.

The culprit can be many things, but the most common one is that the IDE is trying to contact a server in order to check certificate store validity. If the server can't be reached properly (due to proxies and whatnot), the IDE will hang before timing out.

So, if you have a problem with Visual Studio hanging when stopping a debug, try the following:

First, unplug the network cable (or if you are running wireless, kill the wireless NIC). If this solves the problem, you have an issue with the certificate store. If the IDE still hangs, remove all breakpoints in the code and try again. If there still is a problem, remove the .sou file and retry, this can be corrupt and cause a slowdown.

If you had a snappy IDE with the network cable unplugged, either leave it unplugged, or try one of the following solutions.

Before changing the settings for the certificate store, make sure that all unnecessary protocols are disabled in the network properties. Reports have been made that especially NetWare can interfere. This might solve your problem.

Change the certificate revocation setting in Internet Explorer. Open IE, go to Tools > Internet Options > Advanced > Security > Check for Publisher's Certificate Revocation and uncheck this option. This is a bit unsafe to do though so be aware.

Another solution is to edit the hosts file (\windows\system32\drivers\etc\hosts) to point the URL to your own machine. Add 127.0.0.1 crl.microsoft.com to the file. This is just as unsafe as changing the setting in IE and might end up a change that you forget which can cause grief in the future.


For me, changing the IE settings solved it and I can finally be happy when debugging in Visual Studio.

Monday, October 12, 2009

BizTalk orchestration expression shape unable to write entries to Windows eventlog

I were just in the process of debugging an orchestration in BizTalk 2006r2 the old fashioned way: writing eventlog entries from an expression shape when I noticed that I got an exception in the eventlog instead. The exception was of type "Security Exception" with an inner exception detailing "Requested registry access is not allowed.". Easy enough, a quick google turned me to this blogpost and the solution which is to add the appropriate BizTalk service account to the eventlog node in the registry. After setting the permission, writing entries work.