Operation is not valid due to the current state of the object in Enterprise portal in Dynamics AX - assemblies

I am getting following error in enterprise portal in Dynamics AX
Operation is not valid due to the current state of the object.
Microsoft.Dynamics.Framework.Portal
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxFilter.GetFilterStringFromPostBackValue(String postBackValue)
at Microsoft.Dynamics.Framework.Portal.UI.WebControls.AxFilter.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I noticed that the error appears in the modal windows. You can try to set the property <dynamics:AxGridView ShowFilter="false"/> and error disappears

Related

Index was outside the bounds of the array exception on GridView.LoadControlState after upgrading to ASP.NET 4

I've got a client with a legacy ASP.NET WebForms app that was, previously, running ASP.NET 2.0. The site needed a new feature that necessitated using a third-party component that required ASP.NET 4, so we moved his application from ASP.NET 2.0 to ASP.NET 4.0 and the move went smoothly except we're getting the following intermittent exception:
System.IndexOutOfRangeException
Index was outside the bounds of the array.
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Web.UI.WebControls.GridView.LoadControlState(Object savedState)
at System.Web.UI.Control.LoadControlStateInternal(Object savedStateObj)
at System.Web.UI.Page.LoadAllState()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.maintenancetechnician_advancedsearch_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
There were some Stack Overflow questions on this, but all had to do with load balanced/multi-server environments and having this happen when a request bounced from one server with different settings than another (such as one having had some .NET SP installed and the other not).
But this is running in a single-server environment.
Moreover, this problem didn't start until the upgrade to ASP.NET 4. Searching hte ELMAH error logs reveals that this exception has happened 8 times today and not once prior to today (as far back as our logs go, at least, which is a month).
Any ideas on where to go from here?
I agree that posting code would help, but I think I may know what's happening. We ran into a similar issue a few months ago. It ended up being that the Gridview control had it's EnableViewState set to false. Check that viewstate is enabled on the grid and see if that clears it up.
This site has a decent description of what happens when the viewstate is off:
http://forums.asp.net/t/1026981.aspx?ObjectDataSource+GridView+Disabled+ViewState+Major+Concurrency+Issues+possible+solution+

Getting lots of "Object reference not set to an instance of an object." errors on Page_Load

we are getting a large amount of errors being reported from our website.
in Debug mode we are not seeing any and we cant seem to find a pattern.
about 1 in every 50-100 pageviews experience the error.
Any help would be greatly appreciated! thanks!
Error
Object reference not set to an instance of an object.
StackTrace
at _Default.Page_Load(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)
Without specifics it may be hard to diagnose. You could try to add more debug info into your release build in your project options for release configuration - this may then give you a line number.
Add some logging into there either through log4net or trace.write to try to get some more info out of this.
Is page_load accessing any httpcontext, cache, session, or application values?

Execution of the command requires an open and available connection. The connection's current state is broken

Serious problem with entity framework & sql server 2008, please help!!
System works well locally but during load test at production server we have following error for more then 10 users.
After get this error user can not logged in anymore.
Server Error in '/' Application.
Execution of the command requires an open and available connection. The connection's current state is broken.
Here is SQL Server Log
3005
An unhandled exception has occurred.
9/13/2011 3:41:14 AM
9/13/2011 7:41:14 AM
73b3f335f4de45fa8c4ef2f22809300b
4911
482
0
/LM/W3SVC/14/ROOT-3-129603711416579333
Full
/
E:\WebSites\Medtrack2.0\
COLO-VDEV01
15864
w3wp.exe
NT AUTHORITY\NETWORK SERVICE
InvalidOperationException
Execution of the command requires an open and available connection. The connection's current state is broken. at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source) at Dashboard.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
http://38.127.112.89:9010/Dashboard.aspx
/Dashboard.aspx
119.148.4.83
JMiranda
True
Forms
NT AUTHORITY\NETWORK SERVICE
11
NT AUTHORITY\NETWORK SERVICE
False
at System.Data.Objects.ObjectContext.EnsureConnection() at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable.GetEnumerator() at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source) at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source) at Dashboard.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
have any idea?
See if the answer to this similar question can help you:
EF recovery from invalidoperationexception caused by server being down
or this one:
Exception: Execution of the command requires an open and available connection. The connection's current state is broken.
How are you storing the ObjectContext? From an EF perspective, you have to make sure each user gets a unique reference to the ObjectContext. To do that, I share the ObjectContext by storing it in the HttpContext.Current.Items collection. See this for more information on the Items collection: http://abhijitjana.net/2011/01/14/when-we-can-use-httpcontext-current-items-to-stores-data-in-asp-net/

How to trace Error on a Deployed ASP.Net Application?

VS 2008 / ASP.Net
I have a deployed a ASP.Net Web Application on Windows 2003 Server. For some reasons, it throws an error.
Application works great on my local computer. Either from source code or hosted on my local machine (Windows XP).
How to trace error on a deployed ASP.Net Web Application ?
Error :
Object reference not set to an instance of an object. Description: An
unhandled exception occurred during the execution of the current web
request. Please review the stack trace for more information about the
error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not
set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
_Default.ExportRx30ToSalisburyAccessDB() +351
_Default.Button1_Click(Object sender, EventArgs e) +5
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Source code : Which i am facing this error ..
try
{
Access.Application access1 = new Access.Application();
// Open the Access database for exclusive access
string sSalisburyAccessDB = Server.MapPath("~/App_Data/Salisbury.mdb");
access1.OpenCurrentDatabase(sSalisburyAccessDB, true, null);
// Drop the existing table data
access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "drug");
access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "patplan");
access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "plans");
access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "price");
access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "rx");
access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "patient");
access1.DoCmd.DeleteObject(Access.AcObjectType.acTable, "plntrak");
// Run the saved import
access1.DoCmd.RunSavedImportExport("SalisburyODBC");
// Close the database
access1.CloseCurrentDatabase();
// Quit MS Access
access1.Quit(Access.AcQuitOption.acQuitSaveAll);
Response.Write("successful");
}
catch (Exception ex)
{
Response.Write(ex.InnerException.Message);
}
Try running your app in IIS Express instead of Cassini (the built-in Visual Studio development web server). They behave differently and you might have a better shot at recreating the issue in your development environment. IIS Express runs just like real IIS so there are fewer surprises when you deploy your application.
Try deploying the application in debug mode, which should give you a specific line number and code file where the error occurred. Simply place this in your web.config file:
<configuration>
<system.web>
<compilation debug="true">
</system.web>
</configuration>
However, in general, you do not want to deploy to final production in debug mode. Instead, make use of try...catch blocks and good status/exception logging in your application to track down problems.
The easiest way to find where such errors occur is to split your methods down to just do one thing per method. For example, instead of adding a comment that say // Run the saved import, make a method of it RunTheSavedImport() and you will much easier be able to detect in which part of the code the error occurs directly from the stack trace.
What I can see , if the code you have provided is the full ExportRx30ToSalisburyAccessDB-method, the most probable causes for this error is that either DoCmd, AcQuitOption or AcObjectType of some reason are null. Since the stack do not enter Application it can only be caused by objects inside this method.
[ObjectDisposedException: Cannot access a closed resource set.] System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase, Boolean isString) +1657 System.Resources.RuntimeResourceSet.GetString(String key, Boolean ignoreCase) +12 System.Resources.ResourceManager.GetString(String name, CultureInfo culture) +78 SourceCode.Workspace.OOBReports.ReportList.CreateChildControls() +347 System.Web.UI.Control.EnsureChildControls() +146 System.Web.UI.Control.PreRenderRecursiveInternal() +61 System.Web.UI.Control.PreRenderRecursiveInternal() +224 System.Web.UI.Control.PreRenderRecursiveInternal() +224 System.Web.UI.Control.PreRenderRecursiveInternal() +224 System.Web.UI.Control.PreRenderRecursiveInternal() +224 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3394
simply reset your IIS server.

System.Web.HttpUnhandledException

I am working on web application which is using lot of Ajax controls. I am not the developer of the application. I working on rectifying this issue. This application keeps throwing the error message below:
Source: System.Web
Message: Exception of type 'System.Web.HttpUnhandledException' was thrown.
Stack trace:
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.whyfj_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I tried searching on google but didn't get any solution. I am not facing this problem in local server and main thing this is that its random error. Some time same pages works very well.
Server : 2008, IIS 7.5
Please help
That's not the stacktrace of the actual exception, just the stacktrace of the Error handling framework. Unless you can find the innerException in the event logs, you won't be able to fix this easily.
Approach the developer.

Resources