views:

1057

answers:

7

We are getting intermittent problems on a production server that we cannot recreate.

There are two very strange things about the issue. Firstly it's a method not found error on the constructor (ctor) for an exception handling helper class and secondly we have custom errors switched on for remote users and this property is being ignored.

The detail of the error is:

Server Error in '/MyWebsite' Application.


Method not found: 'Void MyExceptionHelperClass..ctor (System.Exception)'.

...
Exception Details: System.MissingMethodException: Method not found: 'Void MyExceptionHelperClass..ctor (System.Exception)'.
...

The stack trace is pretty unhelpful.

My thoughts are that there may be an out-of-memory error or something like that that is killing the page. When the exception handling code kicks in it tries to create an exception object which fails for the same reason giving this error.

However this is wild speculation. We are waiting for the event logs to see whether anything is amiss with the server but in the meantime does anyone have any thoughts or suggestions?

UPDATE:

It has proven difficult to get information out of the team responsible for the production servers but I have managed to find out that as far as load balancing is concerned, this site is currently only running on one server (this can be made to switch over onto another if necessary). Given that this is an intermittent problem and there is only one server involved, then I find it difficult to believe that this could be an assembly issue. Surely if it was then the problem would occur every time?

+1  A: 

Do you have a no parameter public constructor defined for MyExceptionHelperClass in your code? Or is the class meant to only have static methods, in which case it should be a static class.

public class MyExceptionHelperClass()
{
   public MyExceptionHelperClass() { }
}
John JJ Curtis
It's not a static class as it has its own properties and we pass around instances of it. There are loads of constructors but they all have parameters. Is this a good place to start looking? Also, its VB.Net (unfortunately)
Chris Simpson
Just checked the code and there is definitely a constructor that corresponds with the piece of code that is erroring. "Catch ex As Exception ... Throw New Errors. MyExceptionHelperClass(ex) " - "Public Sub New(ByVal InnerException As Exception)"
Chris Simpson
Are you able to post the full code of your Errors.MyExceptionHelperClass ?
John JJ Curtis
It's over 1300 lines long so probably not a good idea. You may have already guessed but I renamed the class and the website for the purposes of the code above. Is there any particular bit you wanted to look at?
Chris Simpson
Do your server machines have debug enabled and custom errors turned off? That might yield more error information...
John JJ Curtis
A: 

Unfortunately, this may be one of those cases where the error message is of little to no value. In my experience, this general class of exception may be the result of either a configuration issue or bad logic aroung threading/app domains. For example, I have seen similar issues upon attempting to load the same assembly into an app domain more than once.

You mention that this is difficult to reproduce. If it's only happening on one server in the production farm it's more likely to be a config issue (with that machine). If it's happening on more than one server than it could be either config or threading.

It might be worth spending some time looking at the larger code base around the areas mentioned above. The root cause may not be in this class. Good luck!

Jason Weber
+2  A: 

I would use elmah: http://code.google.com/p/elmah/ to hopefully give you a bit more insight into the issue. It is free and can be used on an existing site without any recompilation. Try it - and post back if the issue is still happening.

rifferte
A: 

I think it's a Framework issue with keeping compiled versions consistency. It's common to see same sort of errors while updating site sources repeatedly. Just try something like

net stop iisadmin /y && del /q /f /s "%systemroot%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\*.*" && iisreset
sinm
+8  A: 

If you see this error happening on a site that has custom errors turned on, then the error is happening in the custom error handling routine itself.

From the look of the .NET error message it appears that your routine is expecting a constructor that accepts an exception by reference - your comment above shows a constructor that accepts by value.

Check carefully that there isn't a stale version of an assembly in your system somewhere. These can lurk in the Temporary ASP.NET Files folder; you'll need to do an "iisreset /stop" before you can clear them out.

In that regard it's always a good idea to make sure that AssemblyInfo.cs is set up to automatically stamp version numbers in some way. We have our version numbers tied to our source code repository system and CI build box so we can tell exactly what was in what assembly really easily.

Jeremy McGee
This is interesting, thanks.
Chris Simpson
+1  A: 

As others have also mentioned, I would suspect that your site is somehow using an out of date version of an assembly. Something you could try doing is a full Precompile of your site before deploying to your production server. This ensures that ASP .Net doesn't dynamically compile the site on the fly, and therefore should mean that it's using completely up to date code throughout.

tbreffni
Thanks, I don't think it's an out of date assembly but the precompile tip is a good one.
Chris Simpson
A: 

What version (incl. build) of the .NET framework do you have on that server? I've encountered a number of strange issues with 2.0.50727.42.

Michael Morton