Originally posted by d000hg
View Post
OK so the actual error was an access violation. This was occuring in Managed Code.
Code:
try
{
callToWebService(parameter1, parameter2,auditAccount, parameter3); //Breaks here
}
catch (Exception ex)
{
LogEvent("Summat 'appened",9999);
}
Because of my sloppy, but valid, code the web service call was implemented thus :
Code:
callToWebService(parameter1, parameter2,System.Security.Principal.WindowsIdentity.GetCurrent().Name, parameter3);
) You can clearly see it try and evaluate the 3rd parameter first (as expected). This line then jumps into building the proxy stub generated by the IDE when you include the web reference. The parameter, when run as a windows service only, evaluates to null. The web service call never actually happens, rather it gets to the point of making the call, then throws a structured windows exception, which then jumps in the debugger to :ntdll.kiuserexceptiondispatcher
The thread in mscorlib collapses without trace, and windows bubbles the structured exception up until it hits service manager, which then dumps it to the event log with a rather vague message.
By splitting the code out into two calls, thus :
Code:
string accountName =System.Security.Principal.WindowsIdentity.GetCurrent().Name; callToWebService(parameter1, parameter2,accountName, parameter3);
The only way to catch this behaviour was by attaching a debugger to the compiled image using WinDB and SOSex.dll.
Much fun had stepping through IDL and assembly, chasing down hex addresses as the integrated code view didn't work


Comment