"The source type could not be found" appears until application pools recycle

Topics: Validation Application Block
Mar 9, 2010 at 7:01 PM

Our application uses the Enterprise Library's PropertyProxyValidator class to validate user input (v4.1 - Oct 2008).  On occassion, the code will raise an exception saying the source type cannot be found.  This error persists until the application pools recycle at night, at which point everything works again.  It tends to only affect one of the web front ends at a time (there are two).

I tracked down where the exception was being raised, and this is the section of code:

Type IValidationIntegrationProxy.ValidatedType
{
	get
	{
		if (string.IsNullOrEmpty(this.sourceTypeName))
		{
			throw new InvalidOperationException(Resources.ExceptionNullSourceTypeName);
		}
		Type validatedType = BuildManager.GetType(this.SourceTypeName, false, false);
		if (validatedType == null)
		{
			throw new InvalidOperationException(
				string.Format(CultureInfo.CurrentUICulture,
					Resources.ExceptionInvalidSourceTypeName,
					this.sourceTypeName));
		}

		return validatedType;
	}
}

(The value for this.SourceTypeName is shown in the exception and I've checked that it matches exactly.)

We have never been able to reproduce this exception and at this point don't have any ideas left as far as causes.  For a while, my suspicion was that it was related to the Temporary ASP.NET Files folder.  The last time the error occurred, I copied that folder from both web front ends.  Then the next day when things were back to normal, I copied the folders.  When I did a directory and file comparision of the affected web front end, I found no differences.

Our application is essentially user controls hosted in web parts on SharePoint (they don't do anything with SharePoint - in fact, for a while, we were developing the controls on ASPX pages).  There are two servers in the farm, both with Windows Server 2003 R2 Standard x64,  IIS 6, and .NET v3.5.

Any ideas for causes would be greatly appreciated.  I could also use suggestions on tools I could use to try and debug this when happens again (it happens 2-3 times a month) in production.

Thanks!

Mar 10, 2010 at 10:19 AM

Hi,

Can you post the full exception? Also, since you have the suspicion on the Temporary ASP.NET Files folder, can you try to clean that up?

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Mar 10, 2010 at 3:36 PM

Type : System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : The source type could not be found for name "TheApplicationNamespace.TheClass".
Source : Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet
Help link :
Data : System.Collections.ListDictionaryInternal
TargetSite : System.Type Microsoft.Practices.EnterpriseLibrary.Validation.Integration.IValidationIntegrationProxy.get_ValidatedType()
Stack Trace :    at Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet.PropertyProxyValidator.Microsoft.Practices.EnterpriseLibrary.Validation.Integration.IValidationIntegrationProxy.get_ValidatedType()
   at Microsoft.Practices.EnterpriseLibrary.Validation.Integration.ValidationIntegrationHelper..ctor(IValidationIntegrationProxy integrationProxy)
   at Microsoft.Practices.EnterpriseLibrary.Validation.Integration.AspNet.PropertyProxyValidator.EvaluateIsValid()
   at System.Web.UI.WebControls.BaseValidator.Validate()
   at System.Web.UI.Page.Validate(String validationGroup)
   at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Unfortunately, I can't try cleaning up the Temporary ASP.NET Files folder because it would require stopping IIS.  We share the server with another SharePoint web application and the business owners of that application have requested there be no down time through the next month as it is their busy season.

I suspected the Temporary ASP.NET Files folder because I saw an old version of one of our DLLS on one of the servers in the farm.  The last time this error occurred, it was on the other server in the farm that did not have that old DLL in the Temporary ASP.NET Files Folder.

Mar 11, 2010 at 10:02 AM

Hi,

A more basic question. The error you've said happens when you tried to validate on the UI (on postback) but the dll where the type that you are validating does not exist.  On the page where the error occur, does it have (sometimes) successful validation? Because you've said that "on ocassion", i assume that it means that sometimes error occur and sometimes not.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Mar 11, 2010 at 4:03 PM

Yes, it is sometimes successful (in fact, most of the time it is).  When it doesn't work, it fails for everyone until the application pool is recycled.  So it might work Monday - Wednesday, then not work at all on Thursday for anyone, then work completely fine on Friday.  It is not just on one page either.  We are using the PropertyProxyValidator on multiple pages throughout the system and when it starts failing, it fails on all of the pages that use it.

I had tried posting this issue first to the forums.asp.net (http://forums.asp.net/t/1532620.aspx), but I still have not had any luck resolving it.

Mar 18, 2010 at 2:10 PM

The error happened again yesterday on one of the web front ends.  I went in to the site and did some steps that caused a property proxy validator to be triggered and fail validation.  The error appeared in our log.  I then went to the bin directory and gave Everyone Read, Read & Execute, and List Folder Contents rights on the bin folder.  I repeated the steps and it worked.