Arithmetic operation resulted in an overflow - asp.net-mvc

The application is working well in Win server 2003 /IIS 6.0 environment.
When I move the code to win server 2008/IIS 7.0 , I am getting below error? Could you advise what is the error cause? Did i missed anything?
Server Error in '/' Application.
Arithmetic operation resulted in an overflow.
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.OverflowException: Arithmetic operation resulted in an overflow.
Stack Trace:
[OverflowException: Arithmetic operation resulted in an overflow.]
System.IntPtr.ToInt32() +37
CoreLab.Common.a.a(Delegate A_0) +1935
CoreLab.Oracle.ab.a(OracleConnection A_0) +214
CoreLab.Oracle.OracleConnection.Open() +375
MonsterWorldwide.iTime.DataAccess.TimecardDA.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotal) in c:\inetpub\wwwroot\mtitimeproduction\dataaccess\timecardda.cs:28
MonsterWorldwide.iTime.BusinessLogic.TimecardBL.GetTimecardPageInfoSet(Int32 personId, Int32 pageNumber, Int32 rowsPerPage, Int32& rowsCountTotal) in c:\inetpub\wwwroot\mtitimeproduction\businesslogic\timecardbl.cs:24
MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.LoadData() in c:\inetpub\wwwroot\mtitimeproduction\webgui\webparts\timecardlist.ascx.cs:112
MonsterWorldwide.iTime.WebGUI.WebParts.TimecardList.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\mtitimeproduction\webgui\webparts\timecardlist.ascx.cs:52
System.Web.UI.Control.OnLoad(EventArgs e) +132
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4927

[OverflowException: Arithmetic operation resulted in an overflow.]
System.IntPtr.ToInt32() +37
CoreLab.Common.a.a(Delegate A_0) +1935
CoreLab.Oracle.ab.a(OracleConnection A_0) +214
This looks like some poorly written unmanaged interop code which doesn't take into account the CPU type and which blows when run in a x64 bit OS. In a 64-bit OS pointers are 64-bit integers contrary to 32 bit OS.
Maybe you should check the documentation of this CoreLab.Common component you are using whether it supports 64-bit systems.
Quote from the documentation of the IntPtr.ToInt32 method:
OverflowException: On a 64-bit platform, the value of this instance is too large or too small to represent as a 32-bit signed integer.

Related

Oracle TTC error in MVC Entitiy Framework

I want to use the Model First workflow in Entity Framework with Oracle SQL.
I can create new elements into the db with the Create Controller, but when I want to display it I got a not so detailed TTC error message:
TTC Error
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.Exception: TTC Error
Source Error:
Line 18: public ActionResult Index()
Line 19: {
Line 20: return View(db.VALLALAT.ToList());
Line 21: }
Line 22:
Source File: ...\Controllers\VallalatController.cs Line: 20
I got this error with every model, that got a data in the SQL table
[Exception: TTC Error]
OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int64 initialLOBFetchSize, Int64[] scnFromExecution, Boolean bAllInputBinds, Int32 arrayBindCount, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Int64[]& rowsAffectedByArrayBind, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause, List`1& implicitRSList, Boolean bLOBArrayFetchRequired) +3350
OracleInternal.ServiceObjects.OracleDataReaderImpl.FetchMoreRows(Int32 noOfRowsToFetch, Boolean fillReader, Boolean returnPSTypes) +1511
Oracle.ManagedDataAccess.Client.OracleDataReader.Read() +1365
System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead() +36
[EntityCommandExecutionException: An error occurred while reading from the store provider's data reader. See the inner exception for details.]
System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.HandleReaderException(Exception e) +145
System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead() +49
System.Data.Entity.Core.Common.Internal.Materialization.SimpleEnumerator.MoveNext() +41
System.Data.Entity.Internal.LazyEnumerator`1.MoveNext() +112
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +387
System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
My enviroment:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bi
Entity Framework 6.0
Oracle.ManagedDataAccess & EntityFramework 18.3
Yay! I got the answer.
The Visual Studio generated me the table, with an NCLOB property. I changed the NCLOB to VARCHAR2 and now finally display the list correctly.
Update:
Don't forget to degrade the ODP.NET driver to 12.2 from 18.3
Degrade the ODP.NET driver to 12.2

External component has thrown an exception after framework upgrade on server

I recently upgraded a 2008 R2 Web server to .Net Framework 4.6.1. I then installed my ASP.NET MVC application on such which is built to .Net Framework 4.6.1. When I attempt to run the site, I get the following error.
External component has thrown an exception.
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.Runtime.InteropServices.SEHException: External component has thrown an exception.
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:
[SEHException (0x80004005): External component has thrown an exception.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +485
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +190
System.Reflection.Assembly.LoadFrom(String assemblyFile) +54
WebActivator.ActivationManager.get_Assemblies() +244
WebActivator.ActivationManager.RunActivationMethods() +86
WebActivator.ActivationManager.RunPreStartMethods() +46
WebActivator.ActivationManager.Run() +68
[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: External component has thrown an exception..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +900
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +164
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +169
System.Web.Compilation.BuildManager.ExecutePreAppStart() +172
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +907
[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: External component has thrown an exception..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +726
I did same process on other similar servers and didn't hit an issue.
I did find that in IIS (which the site is running in), if I change the application pools "Load User Profile" setting to false then the site runs without a problem.
I don't just want to change this setting (unsure of its impact on the application), I would like to understand why I need to make such a change on this server and didn't need to on others. Was it the way the framework was installed or server is setup? Any feedback would be great.
(note: the server has version 4.5 installed and the site when built in such, ran without an issue)
I ran in this problem once, on many cases problem is due to some software in the dev suite that was not up to date. In my case the problem was caused due to Telerik justMock, The problem was resolved by updating justmock to latest version. Try to update or uninstall Telerik tools if you have one, Hope this solves your problem
External component has thrown an exception.
I had before similar problem after installing .Net Framework 4.6.1 - I have not figured out what component cause problem, but problem was related to missing .NET Framework 4.5.1 Targeting Pack.
Solution in my case:
uninstall all .NET Frameworks,
install .NET Framework 4.5.1 Developer Pack
install .NET Framework 4.5.2 Developer Pack
install .NET Framework 4.6.1 Targeting Pack
(the order is important)
All downloaded form official site: Targeting .NET Platforms

ODP.net managed driver throws ORA-12570: Network Session: Unexpected packet read error

In one of our products we retrieve data from the Oracle database using stored procedures using the ODP.net managed driver.
Every now and then (roughly every 1000 queries) we get the following exception:
(ORA-12570: Network Session: Unexpected packet read error)
---> Oracle.ManagedDataAccess.Client.OracleException: ORA-12570: Network Session: Unexpected packet read error
---> OracleInternal.Network.NetworkException: ORA-12570: Network Session: Unexpected packet read error
---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: size
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, SocketError& errorCode)
at OracleInternal.Network.ReaderStream.ReadIt(OraBuf OB, Int32 len)
--- End of inner exception stack trace ---
at OracleInternal.Network.ReaderStream.ReadIt(OraBuf OB, Int32 len)
at OracleInternal.Network.ReaderStream.WaitForReset()
at OracleInternal.Network.OracleCommunication.Reset()
at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int32 initialLOBFetchSize, Int64[] scnFromExecution, Boolean& bAllPureInputBinds, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause)
--- End of inner exception stack trace ---
at Oracle.ManagedDataAccess.Client.OracleException.HandleError(OracleTraceLevel level, OracleTraceTag tag, Exception ex)
at OracleInternal.TTC.TTCExecuteSql.ReceiveExecuteResponse(Accessor[]& defineAccessors, Accessor[] bindAccessors, Boolean bHasReturningParams, SQLMetaData& sqlMetaData, SqlStatementType statementType, Int64 noOfRowsFetchedLastTime, Int32 noOfRowsToFetch, Int32& noOfRowsFetched, Int64& queryId, Int32 longFetchSize, Int32 initialLOBFetchSize, Int64[] scnFromExecution, Boolean& bAllPureInputBinds, DataUnmarshaller& dataUnmarshaller, MarshalBindParameterValueHelper& marshalBindParamsHelper, Boolean bDefineDone, Boolean& bMoreThanOneRowAffectedByDmlWithRetClause)
at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int32 lobPrefetchSize, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Boolean isFromEF)
at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
It seems like ODP.net is calling System.Net.Sockets.Socket.Receive with an invalid size parameter (<=0 or greater than the length of buffer minus the value of the offset parameter).
The exception cannot be reproduced manually and is never raised while executing different procedures with different parameters (ie it's random).
Configuration:
ODP.net managed driver version: 4.121.1.0
.net framework 4.5
Oracle server version: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 (Linux)
Has anyone already experienced this issue? Are there any fixes available?
Thanks in advance!
After opening a ticket with the Oracle support, they sent an unofficial updated version of the managed ODP.net library which seems to fix the issue.
Hopefully the fix should be part of the next ODAC release (the latest available today is from Oct 2015).
If you see this error in your application, it's probably due to the same bug in the managed ODP.net library, not the way you use it.
Another thing to consider is if something in the network infrastructure could interrupt idle tcp/ip connections during the execution of long requests as described in this SO answer.
After reading through a similar question at ODP.NET Oracle.ManagedDataAcess random ORA-12570 errors, it seems like it's actually a pooling problem. Apparently the answer is to either set Pooling=false in the Connection String, or to find out just how many threads can be opened and how long the connection can be open before it becomes too much for Oracle to handle. This was the answer the author of that question posted:
To find the best configuration with pooling enabled I created a test application to start 50 threads (each one doing 1 test each 50ms), and decreased the default pool values until the error stoped. This way I was able to get an optimal configuration, stable, without any errors.
Obviously it does not applies to every server, but this is my final connection string configuration:
Pooling=true;Min Pool Size=1;Connection Lifetime=180;Max Pool Size=50;Incr Pool Size=5

Unable to get ImageMagick .Net working with Asp.Net 4.0

I have downloaded the ImageMagick.Net source code from Codeplex and compiled using Visual Studio 2010. It builds but when I use the generated ImageMagickNET.dll into my Asp.Net 4.0 application I get the following error.
External component has thrown an exception.
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.Runtime.InteropServices.SEHException: External component has thrown an exception.
Source Error:
Line 1049: void Image::Read(System::String^ imageSpec)
Line 1050: {
Line 1051: image->read(Marshaller::SystemStringToStdString(imageSpec));
Line 1052: }
Line 1053:
Source File: d:\dev\projects\imagemagick-63489\imagemagick.net\imagemagicknet\image.cpp Line: 1051
Stack Trace:
[SEHException (0x80004005): External component has thrown an exception.]
Magick.Image.read(Image* , basic_string<char\,std::char_traits<char>\,std::allocator<char> >* ) +0
ImageMagickNET.Image.Read(String imageSpec_) in d:\dev\projects\imagemagick-63489\imagemagick.net\imagemagicknet\image.cpp:1051
ImageMagickTest._Default.Page_Load(Object sender, EventArgs e) in D:\Sites\ImageMagickTest\ImageMagickTest\Default.aspx.cs:22
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207
Has anyone got ImagMagick.Net working by compiling from the source code?
I know this is a bit of an old question, but this looks similar to an issue with unmatched ImageMagick versions that I was seeing.
If you are using the ImageMagickNET from their sources, you need to make sure you have ImageMagick 6.5.3-10 installed. This probably means building that release from sources, as I don't think the binaries are available anywhere (at least for Windows).
If you updated the ImageMagickNET project with sources from a new ImageMagick release, then you can use it with your newer installed version of ImageMagick. However, I experience several crashes when trying this approach with ImageMagick 6.6.6-10 on Windows. It may be that too much has changed in the underlying library for the ImageMagickNET wrapper to work correctly with this more recent version.

crazy asp.net error

Hi I am having a problem debugging an issue on a website. Everything works locally, the local and server databases are the same
The strange thing about the error is that it points to my local dev machine in the error stack. Is that crazy or what, The files are published and being hosted on a server machine and the error is pointing to a line of code on my local dev box. I feel like I am losing the plot. Can someone pls help be clear the air here because this is very weird
Error in '/' Application.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
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.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
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:
[ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index]
System.Collections.ArrayList.get_Item(Int32 index) +10066148
System.Collections.Specialized.NameObjectCollectionBase.BaseGet(Int32 index) +17
System.Web.HttpFileCollection.get_Item(Int32 index) +9
System.Web.HttpFileCollectionWrapper.get_Item(Int32 index) +18
PitchPortal.Web.Binders.DocumentModelBinder.ValidateAndAssignPostedFile(ControllerContext controllerContext, ModelBindingContext bindingContext, Document doc) in C:\Users\Bich Vu\Documents\Visual Studio 2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs:73
PitchPortal.Web.Binders.DocumentModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) in C:\Users\Bich Vu\Documents\Visual Studio 2008\Projects\PitchPortal\PitchPortal.Web\Binders\DocumentModelBinder.cs:45
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +404
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +140
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +658084
System.Web.Mvc.Controller.ExecuteCore() +125
System.Web.Mvc.c__DisplayClass8.b__4() +48
System.Web.Mvc.Async.c__DisplayClass1.b__0() +21
System.Web.Mvc.Async.c__DisplayClass8`1.b__7(IAsyncResult _) +15
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +85
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +454
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263
The strange thing about the error is
that it points to my local dev
machine in the error stack. Is that
crazy or what
No it is not :-) The pdb (program database file) holds the information about the files.
http://msdn.microsoft.com/en-us/library/ms241903.aspx
Since you compiled it locally before deploying to the server, the PDB stores the information about your local files. It does not mean your server is talking to your development box.
Turn off your development box, and re-run the app. Something's hitting your dev box without you realizing it.
The stack trace references file paths based on the development machine you compiled it on. To remove these artifacts for a production server, you should compile in release mode which will not contain full debug info.

Resources