Monday, May 6, 2013

AJAXControlToolKit and Telerik Issue


 

Hi All
 
Recently I hit a weird issue; I had a runtime error  reported by Telerik control, The web site is compiled using .Net Framework 2.  

Error Message

Message : Method not found: 'Boolean System.Web.UI.ScriptManager.get_LoadScriptsBeforeUI()'.
Source : Telerik.Web.UI

Apparently Script Manager implementation in such assembly is missing LoadScriptsBeforeUI property implementation;

Steps Applied to resolve issus

I tried building the application to run over framework 3.5; it worked fine and such trial solved the issue however at some of my collegues pcs no such issue exists !!!!! oops  I can't just ask my custmer to upgrade the entire production environment because it just didn't wok on my machine however I was definielty on the right path for getting answers.

I copied same bin and web configuration files from my collegues' machine and gave it a shot,  same error no use; that's kind of fraustrating L
 
I was 100% sure it is related to my environment, something is different on my machine rather than others , I just needed an answer
 
After couple of tries the web site worked fine and the error is gone; interesting what caused the issue ?

Observation

After uninstalling AjaxControlToolKit I noticed that my solution is referencing System.Web.Extensions from GAC while  actual used Assembly was located in the web bin folder !!  a rule of thumb .NETFrameWork will try loading Assemblies from GAC before ones located at Bin folder. It seems AjaxControlToolKit installs different implementation of ScriptManager and registers such new assembly in GAC holding same assembly name and version hence the web site solution never paid attension to assembly stored at the Bin folder
 
Steps to Resolve issue 

·        Uninstall AJAX toolkit removes these assemblies from GAC   

·        Update solution by removing undesired GAC assembly references (these are no longer valid
           but VS doesn’t automatically detect that such assemblies are removed from GAC)

·        Add new assembly references for ones located in Bin directory

·        Build the solution  one more time

 More Ideas
  • We can difinelty use tool like disassembler to compare the two Assemblies' methods and propreties; but I am statisfied with what I have reached so far;  will have to leave this for you to accomplish good luck with that.