Emgu.CV.CvInvoke exception in iisexpress.exe - c#

I use the library Emgu.CV.World and a set of classes x86 in web solution ASP.NET MVC5. Version EMGU: 3.1.0.2282.
For a while it worked, then I made a copy of the project in the same directory and changed the name of the folder, then began to appear the error:
An exception is thrown at 0x2AF630B1 (cvextern.dll) in iisexpress.exe: 0xC0000005: Access violation reading location 0x00000000.
This same functionality is implemented in the Win Forms application of the same libraries, it works without problems.
But web application all the time breaks down, on this method : CvInvoke.Threshold ().
Used x86, x64 catalogs, copy all the libraries in a separate directory, change the type of application to any CPU , x86 to x64 and nothing.
Tried on other systems (64-bit) is the same. Most interesting is that initially it worked, ie, the error my code is not.
I used, IIS Express 10, vs 2015 community.
I would be grateful for some advice, thanks

The answer was found. The reason for the error has become not noticed during the last refactoring line: imgGray.Dispose();
imageRotate = imgGray.Rotate(-avg, new Gray(255));
}
else
{
imageRotate = imgGray;
}
imgGray.Dispose();
//return imageRotate.Bitmap;
return BlackFilterImage(imageRotate);
}
private static Bitmap BlackFilterImage(Image<Gray, byte> img)
{
UMat resultImg = new UMat();
CvInvoke.Threshold(img, resultImg, 105, 255, ThresholdType.BinaryInv); //Error is here
Unfortunately, the nature of the error to muddle me.

Related

Application crashes on debugging a web project with exit code -2147023895 (0x800703e9) in Visual Studio 2017

I am trying to debug a web api project on a newly setup laptop with Visual studio 2017 professional edition.
It uses Target framework of .NET Framework 4.6.1.
The web application (not visual studio) crashes few seconds after starting with this in the output window.
The program '[4868] iisexpress.exe' has exited with code -2147023895 (0x800703e9).
And for every crash, I see this message in Event Viewer
The description for Event ID 0 from source VSTTExecution cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
(devenv.exe, PID 24968, Thread 1) IdleProcessorManager.DoWork - Job threw:
Invalid URI: The format of the URI could not be determined. at
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at Microsoft.VisualStudio.TestTools.TestCaseManagement.SolutionIntegrationManager.IsRunConfig(String filename)
at Microsoft.VisualStudio.TestTools.TestCaseManagement.SolutionIntegrationManager.d__351.MoveNext()
at Microsoft.VisualStudio.TestTools.TestCaseManagement.IdleProcessorManager.DoWork()
The message resource is present but the message was not found in the message table
I already tried deleting .vs folder, restarting pc, uninstall/install vs, uninstall/install .net framework amongst other things.
Can someone help me fix this, unable to get to the 'real' reason for these failures.
Things to note -
1. The project works fine on other machines.
2. I can create a new project using project template and run/debug application successfully.
EDIT : On more investigation I find that the web application breaks (without any error other than the exit code) and exits.
public virtual DataSet Execute(SqlCommand sqlCommand, SqlConnection sqlConnection)
{
if (sqlCommand == null || sqlConnection == null)
{
return null;
}
var ds = new DataSet();
if (sqlConnection.State != ConnectionState.Open)
{
sqlConnection.Open();
}
using (var adp = new SqlDataAdapter(sqlCommand))
{
adp.Fill(ds); <---- BREAKS here!
return ds;
}
}
On another machine where its working, it works perfectly fine. And the SP returns around 390K records. Possible stackoverflow exception?
Please check the Framework versions that are installed to your new laptop.
I suspect that the minor versions don't match wiht your new laptop.
You can check which versions are installed to your machine via the link:
https://learn.microsoft.com/en-us/dotnet/framework/migration-guide/how-to-determine-which-versions-are-installed
Edit:
1- Install the version from :
https://www.microsoft.com/en-us/download/details.aspx?id=49981
2- Or I recommend you to upgrade your Project's framework to .NET Framework 4.7.2

ML.NET: strange runtime error on some machines

I wrote a simple UWP app using the ML.NET framework, and it worked on one of my machines without installing any Nuget packages, without any additional setup etc.
However, on my other machine, after running the application, I get this error:
System.Runtime.InteropServices.COMException: 'Unspecified error
No suitable kernel definition found for op Sub (node Minus675)'
The error happens in this segment of code:
public static async Task<modelModel> CreateFromStreamAsync(IRandomAccessStreamReference stream)
{
modelModel learningModel = new modelModel();
learningModel.model = await LearningModel.LoadFromStreamAsync(stream);
learningModel.session = new LearningModelSession(learningModel.model); // it breaks here
learningModel.binding = new LearningModelBinding(learningModel.session);
return learningModel;
}
In case anyone should ask - yes I have added my .onnx model in the Assets folder. My configuration is: VS 2017, Windows 10 version 1809, build 17763.194, and I have Windows 10 SDK version 10.0.17763.132. I have tried installing the Visual Studio Tools for AI and ML.NET Templates VS extensions, but it didn't help.

Buffer Overflow in clr.dll at application start-up

I have two computers. Both work under Windows 7 Embedded and have same version of .Net 4.0 framework installed.
My WinForms application works with no issues on one of them but fails at start-up with BEX in clr.dll on another.
Problem Event Name: BEX
Application Name: Myapplication.exe
Application Timestamp: 5669ec33
Fault Module Name: clr.dll
Fault Module Version: 4.0.30319.526
Fault Module Timestamp: 4eb3b6b1
Exception Offset: 002b65ec
Exception Code: c0000409
Exception Data: 00000000
OS Version: 6.1.7601.2.1.0.320.65
Locale ID: 1033
Additional Information 1: a835
Additional Information 2: a835052745ddb3bce091e0cd181de7e7
Additional Information 3: 7cb8
Additional Information 4: 7cb8eec426d05584b36071af9d74719d
What is very "strange"
I was able to find two things in my application that somehow have impact or provoke this problem.
First I found exact line of code.. I have few buttons that I manually create manually on UI thread. And if I remove next line my application starts.
btn.Font = new Font("Tahoma", 9, FontStyle.Bold, GraphicsUnit.Point, 0);
Second I noticed that if I use my debug logger which uses StackFrame to find out where log message is coming form, Application will crash with the same error in CLR but at some other place. Not at the line I mentioned above.
My two computers have different RAM. 2GB and 1GB. Application fails on the second one with 1GB of memory. But application iself uses 30 MB and system has ~350 MB of free memory. Could memory be a reason ?
My research for the most part referred me to different hot-fixes issued by Microsoft. I tried them but nothing helped. I also tried to install .Net v4.5 but with the same negative result.
Where else I can start looking for the problem ?
... And yes, this problem does not show up when running application with attached debugger.
Update
I just realised that "Exception Code: c0000409" means STATUS_STACK_BUFFER_OVERRUN. This brings some sense to strange application behaviour that I have but still not clear why it works on one computer but does not work on another.
Solution finally found
My application uses third party C# library which is actually a wrapper on top of calls to other native library. I decompiled library and realised that calling convention is set to CallingConvention.Cdecl but as I see from Dependency Walker application, all methods in native library has CallingConvention.StdCall
After changing calling convention and recompiling the library issue disappeared.

Game working on Win7 but not Vista?

I've been developing a game and after each update I send my friend a setup.exe to use I made with Inno Setup. It's always worked fine up until now. He is able to instal the game but when he runs the .exe he gets "Game has stopped working". While it works fine for me after installing. The only thing I can think of that could of caused this was I added saving and loading using storage containers. I choose the location to save in with:
asyncResult = StorageDevice.BeginShowSelector(playerIndex, null, null);
storageDevice = StorageDevice.EndShowSelector(asyncResult);
asyncResult = storageDevice.BeginOpenContainer("Game1StorageContainer", null, null);
This places the file in: Desktop\Libraries\Documents\SavedGames\Game\Game1StorageContainer\Player1\
This is a vague question but maybe someone has an idea?
:: UPDATE ::
Ok, I've had my friend reinstall the XNA Runtime, same problem.
There are no files in his minidump folder, even with hidden folders shown.
However I have a windows error log here:
Application: My Game.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info:Microsoft.Xna.Framework.GamerServices.GamerServicesNotAvailableException
Stack:
at Microsoft.Xna.Framework.GamerServices.KernelMethods+ProxyProcess..ctor(Microsoft.Xna.Framework.GamerServices.UserPacketBuffer)
at Microsoft.Xna.Framework.GamerServices.KernelMethods.Initialize(Microsoft.Xna.Framework.GamerServices.UserPacketBuffer)
at Microsoft.Xna.Framework.GamerServices.GamerServicesDispatcher.Initialize(System.IServiceProvider)
at Microsoft.Xna.Framework.GamerServices.GamerServicesComponent.Initialize()
at Microsoft.Xna.Framework.Game.Initialize()
at My_Game.Game1.Initialize()
at Microsoft.Xna.Framework.Game.RunGame(Boolean)
at Microsoft.Xna.Framework.Game.Run()
at My_Game.Program.Main(System.String[])
So, It crashed at Game1.Initialize();, which contains:
protected override void Initialize()
{
this.graphics.PreferredBackBufferWidth = 800;
this.graphics.PreferredBackBufferHeight = 600;
this.graphics.IsFullScreen = false;
this.graphics.ApplyChanges();
base.Initialize();
}
So surely it is the base.Initialize();, which I'm guessing is because I've included some new libraries from the framework. So I have no idea what to do, the previous version of my game works fine for him.
Someone have any idea what I can do?
Thanks
Does he have the XNA Runtime installed?
Check the Windows Event Log, it should have a detailed entry for the crash
When an application crashes, a minidump is created. You should be able to load this into visual studio and see where it crashed.

it is possible to get the crash details of a application that triggers Microsoft Windows Error Reporting?

I have an application written in C#. This application is locking by windows, return something like: "The xxx application has stopped working".
Is it possible to get the reason for this crash? I tried using try{} catch{} throughout the application without success. It works on my computer, but not on my friend's computer.
Both computers have same configuration:
Windows seven 7 ultimate 32 bits
Processor:2.13ghz
memory ram: 2gb
UPDATE
Well, in the event log of computer of my friend I found some details of the crash:
Faulting application name: xxxx.exe, version: 1.0.0.0,time stamp:0x4eb5e63a
Fault Module Name:KERNELBASE.dll, version: 6.1.7600.16850, time stamp:0x4e21132b
Exception Code:0xe0434352
Identification of the process that failed: 0x26c
Start time of the faulting application: ...
Faulting application path: ... \xxx.exe
Path F module failures: C:\Windows\system32\KERNELBASE.dll
Report ID: xxxxx-yyyy-dddd-dddd-aaaaaa
UPDATE 2
Finally,I found the function that is causing the exception.
handling the function with try {} catch (Exception Err) {} I found some details of exception:
Err.Message:The device is not ready
Err.Source: mscorlib
how can I fix it?
"Works on my machine" is a very common problem with a myriad of causes. Generally the reason is that something is different between the two machines. Some easy things to rule out:
is your friend's computer a development machine, with Visual Studio installed?
does your application rely on a particular path (for example, a D: drive), a database, a service, a COM component, or something else that an install package should be including?
has your friend configured UAC differently from you? Does one of you sign on as the account Administrator, while the other uses another account that is in the Administrators group?
did you test a debug version on your friend's machine? debug versions usually aren't redistributable
did you test version x of the exe and version y of some class library, forgetting that you made a change to one of them yesterday?
do you and your friend have different versions of IE, Office, or some other component that may be used by the app? Do you have different IE settings (eg proxies?)
are the two computers both completely caught up on updates and service packs?
is the application trying to access some hardware (microphone, web cam) that is not on your friend's machine or is importantly different between the two machines?
The literal answer to your question is yes, you can sign up for something called Windows Error Reporting and get the reports that the dialog says it is collecting. However I sincerely doubt that you want them. You should have all the information you need to find the error right where you are. Concentrate on what is different (even if you think it's irrelevant) between the two machines.
Most likely it is a missing dependency. Double check to make sure that your program is installing all of the Dll's that it needs. I have run into similar problems usually with an .ocx file not being properly registered or not present.
As far as your question goes try using the MDbg.exe file from the .Net Framework SDK or Visual Studio. Microsoft also has other debugging tools available.

Categories

Resources