0
votes

Don't know what to title this. But here's what I had experienced.

I had deployed an Asp.net web application using Publish option of VS 2013. This application is using a layered architecture and has BAL, DAL etc. After a day or two there was a minor change in BAL which was to be deployed. As the change was only in BAL so I just build that BAL project and deployed the DLL of BAL only (without Publishing the whole web application) into the bin of my web application, and some things started breaking with Method not found exception however method was there. The exceptions that I received is below.

Message: Exception has been thrown by the target of an invocation.

Stack Trace: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'System.Collections.Generic.List1 BusinessLayer.Dealer.Dealer_BAL.SelectStoreList(Int32, System.Nullable1, System.Nullable`1)'. at UserInterfaceLayer.DataViews.Dealer.DealerStore.Select(Int32 Mst_Dealer_Id, Int32 userId, Int32 userType) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at Telerik.Web.UI.GridTableView.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.GridTableView.DataBind() at Telerik.Web.UI.RadGrid.DataBind() at Telerik.Web.UI.RadGrid.AutoDataBind(GridRebindReason rebindReason) at Telerik.Web.UI.RadGrid.Rebind() at UserInterfaceLayer.UC.LeaseApplication.UC_PrimaryLeaseInfo.SetControlValue(V2 v2) at UserInterfaceLayer.AddLeaseApplication.TempLeaseAppBind(String TempLeaseId) at UserInterfaceLayer.AddLeaseApplication.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Below is the snip from IL DASM, which shows the method does exist in that dll.

enter image description here

What is suspicious to me is that faded pink box, what's the difference between those solid pink box methods and the faded ones in image above?

To provide more info and recap one more time, In second time deployment:

  • I hadn't published the whole web application.

  • I had deployed just one BAL dll only.

  • The BAL dll that was deployed was build on a different machine than the whole application was build on previously. May be this could be the reason not sure.

1
what is the change you did to BAL dll ? renamed/removed any method ? are you sure this BAL dll is loaded from bin folder ? not from GAC etc ?Kurubaran
what's the difference between those solid pink box methods and the faded ones in image above? stackoverflow.com/questions/8791743/…Mahesh Kava
@Kurubaran This was loaded from bin m sure abt that. no method was removed, even the method that is not being found is there as shown in snip from ILDASM.yogi
@MaheshKava, thanks.yogi
Even when you change your dll you will need to restart your IIS. Can you try restarting iis and check if this works?arpitbakshi

1 Answers

0
votes

Even the method "is there", your WEB site is compiled with old BL assembly, so it can possibly reference "different code" - it could be because of some compile optimisation in release mode (method inlining, tail call optimisation or etc). Try actually locally compile your WEB application with your "new" BL dll referenced. If that succeeds - just redeploy your WEB dll. Not necessarily a publish, you can compile it locally, and replace just DLL, as you did with BL