System.IO.FileNotFoundException. Where do I find what path is wrong? - filenotfoundexception

I create small Windows Forms progs in VisualStudio2010, just for hobby. After releasing them I use the .exe file to run them on other PCs, without having
to do any installation. Those PCs run Windows OS(7,vista,XP). The PC which I wrote the code had Win XP and the progs managed to work fine anytime.
Now I wrote another prog, on another PC, which runs Win 8.1 and I get the following error whenever I try to run the released .exe at other platforms, as mentioned above.
Problem signature:
Problem Event Name: CLR20r3
Problem Signature 01: dmg_ors.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 52f4bad1
Problem Signature 04: DMG_ORS
Problem Signature 05: 1.0.0.0
Problem Signature 06: 52f4bad1
Problem Signature 07: 3
Problem Signature 08: c
Problem Signature 09: System.IO.FileNotFoundException
OS Version: 6.1.7601.2.1.0.256.48
Locale ID: 1033
Additional Information 1: 82e2
Additional Information 2: 82e23b36efee975bd0e9417ff09fe7bb
Additional Information 3: a1d6
Additional Information 4: a1d6e932d2c942475edff9f8fe05b46c
Read our privacy statement online:
http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
If the online privacy statement is not available, please read our privacy statement offline:
C:\Windows\system32\en-US\erofflps.tx
How can I locate what file is missing?
tyvm

Problem solved.I had to modify my main,IOT to catch that exception and see what
was actually missing.
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += new
ThreadExceptionEventHandler(Application_ThreadException);
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
Application.Run(new Form1());
}
static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
{
MessageBox.Show(e.Exception.Message, "Unhandled Thread Exception");
// here you can log the exception ...
}
static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{
MessageBox.Show((e.ExceptionObject as Exception).Message, "Unhandled UI Exception");
// here you can log the exception
}
Then I could see that the problem existed because Visual Basic Powerpack needed to be installed.I assume that machines without VS2010 installed,even if they have .NET 4.5, do not have that. The question is though, what was the difference this time and that package was needed IOT run the application....
The solution was found here actually, I need to say that.
http://www.csharp-examples.net/catching-unhandled-exceptions/

Related

Unable to activate instance of type Android.Util.SparseArray`1[E] from native handle 0x15 (key_handle 0x98855da)

I am just get stuck of this problem.
In xamarin.Android I am getting this is error in ReceiveDetections method.
here is the error:
System.NotSupportedException: 'Unable to activate instance of type Android.Util.SparseArray`1[E] from native handle 0x15 (key_handle 0x98855da).'
Before it was working I'm getting this error after upgrading the android version.
Here is the snippet:
public void ReceiveDetections(Detections detections)
{
SparseArray qrcodes = detections.DetectedItems; // getting the error here
if (qrcodes.Size() != 0)
{
//////////////////////////////
}
}
I am getting this problem in debug mode.
According to the Visual Studio Developer Community, try to
Clear temporary bin and obj files
Update to the latest version of VS
Disable Android Share Runtime
Build the app in release mode, or
Increase the Target Framework version of the Android project to 10 or above
Let me know if neither of those solve your issue

Missing Manifest exception Visual Studio 2010 project converted from 2003, 2008

I have a Win Forms C++ solution that was initially created with Visual Studio 2003, converted to 2008 (successfully) and now I'm attempting to convert it to Visual Studio 2010.
The solution builds without errors then when run I get a missing manifest exception when attempting to load an image list from the resources for a form. The exception happens on the following line of code:
this->m_imageList->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer * >(resources->GetObject(S"m_imageList.ImageStream")));
I think I've found the problem, if I examine the manifest using ildasm of the 2008 assembly I see the following for the resources for the form:
.mresource public SDTP.SDTPDataMonitorForm.resources
{
// Offset: 0x00000000 Length: 0x00006DB0
}
The manifest for the 2010 assembly appears as follows:
.mresource public SDTPnet.SDTPDataMonitorForm.resources
{
// Offset: 0x00000000 Length: 0x00004F57
}
.mresource public '..\\temp\\Debug\\SDTP.SDTPDataMonitorForm.resources' as '..$temp$Debug$SDTP.SDTPDataMonitorForm.resources'
{
// Offset: 0x00008E80 Length: 0x00004F57
}
I'm sure it can't find it due to the extra "net" text in the first instance, and the extra ..$temp$Debug in the second instance.
So finally, my question: Where in the project settings do I fix that? The ..\temp\Debug is part of the project path... Playing around a bit if I change the "Intermediate Directory" setting to just $(Configuration) I now get:
.mresource public 'Debug\\SDTP.SDTPDataMonitorForm.resources' as Debug$SDTP.SDTPDataMonitorForm.resources
{
// Offset: 0x00008E80 Length: 0x00004F57
}
in the manifest file which still generates the exception.
Thanks for any help...
Right click on the .resx file and select properties and edit "Resource Logical Name"

Visual Studio 2010 Bug?

I'm not a bug expert hence y'all shouldn't yell at me if what I am about to say isn't what I should be saying. Here is the situation. I'm building a desktop windows form application in C# using VS 2010 Ultimatum. I added a new user control which contains a picture box that should display an image when some PropertyChangedEventHandler is fired. The application itself works as expected: No compilation error and when I run it, it does what it was meant to do. However VS is acting weird. Indeed, when I open the project in VS, it gives me this message:
I thought maybe my VS installation is corrupted. I reinstalled it, and opened the project again but the same happens. Strangely, if I comment out some code that invoke the PropertyChangedEventHandler , then VS would start and work normally. Is this supposed to be a VS bug? After all, it should at least complain that my code isn't supported but it shouldn't crash just because I wrote some bad code. Besides, if my code compiles and works as expected, can someone please tell me what's wrong?
P.S: Below is the details of the error as shown by VS. I'm looking to hear what you think.
Problem Event Name: CLR20r3
Problem Signature 01: devenv.exe
Problem Signature 02: 10.0.30319.1
Problem Signature 03: 4ba1fab3
Problem Signature 04:<<<<<Hiden for privacy issues>>>>> (It is just the one the namespace where the error comes from! )
Problem Signature 05: 1.0.0.0
Problem Signature 06: 4f288861
Problem Signature 07: 25
Problem Signature 08: 1
Problem Signature 09: System.DllNotFoundException
OS Version: 6.1.7600.2.0.0.256.4
Locale ID: 1033
Additional information about the problem:
LCID: 1033
I have also posted the same thread at MSDN forum
You need to disable PropertyChangedEventHandler from firing in Design mode.
If this is C#, it should look like this:
if(!this.DesignMode)
{
PropertyChanged(this, e);
}
If not that specifically, then disable whatever features might be causing the error from triggering in DesignMode.

WPF Application crashes on WIndows 7 when command executable.Start() is run

I've got a tiny Portal I´m writing, and this portal is supposed to launch installers on button click. I´m developing on VS2010 on a WinXP SP3 station, and on this machine, even fter compilation and publishing, everything works as expected. However, when i run the compiled application in Windows 7, it crashes...The application work, it just crashes when i click a button for program installation.
The programming looks like this:
private void button_access_Click(object sender, RoutedEventArgs e)
{
Process executable = new Process();
string executablePath = "D:\\Visual Studio 2010\\SAFE_Portal1\\SAFE_Portal1\\Extra Programs\\AccessRT2003.exe";
executable.StartInfo.FileName = executablePath;
executable.Start();
}
It specifically crashes on thr button_access_Click procedure...
Any ideas as to why this could be? I`ve tried looking around here in Stackoverflow, and in other forums, but to no avail...
Any help or direction is ganz welcome!
Try this:
try
{
Process executable = new Process();
string executablePath = "D:\\Visual Studio 2010\\SAFE_Portal1\\SAFE_Portal1\\Extra Programs\\AccessRT2003.exe";
executable.StartInfo.FileName = executablePath;
executable.Start();
}
catch (Exception msg)
{
MessageBox.Show(msg.Message);
}
What message are you getting?
Are you sure you want to use fixed paths in your application? If so you should at least check if the file you try to start exists beforehand. Otherwise an exception will be thrown which could be the problem here.
if (File.Exists(executablePath))
{
...
}

Why do I get CA1806 when I catch exception in C++/CLI?

I've recently upgraded my project from Visual Studio 2008 to Visual Studio 2010.
By enabling Code Analysis and compiling in Release, I'm getting warning CA1806: Do not ignore method results.
I've managed to reduce the code that produces the warning to this code:
.h file:
public ref class Foo
{
public:
void Bar();
};
.cpp file:
void Foo::Bar()
{
try
{
}
catch (const std::exception&) // here I get the warning
{
}
}
the warning:
CA1806 : Microsoft.Usage :
'Foo::Bar(void)' calls
'Global::__CxxRegisterExceptionObject(void*,
void*)' but does not use the HRESULT
or error code that the method returns.
This could lead to unexpected behavior
in error conditions or low-resource
situations. Use the result in a
conditional statement, assign the
result to a variable, or pass it as an
argument to another method.
If I try to use the exception value or do catch(...) the warning still appears. If I catch managed exceptions instead or compile in Debug I don't get the warning.
Why do I get this warning?
UPDATE
I've decided to open a bug report on Microsoft Connect.
This is a Visual Studio 2010 bug.
As you can see in the bug report, Microsoft reproduced the bug and has decided to postpone the resolution with no workaround.
You are welcome to vote for the bug so maybe Microsoft will decide to resolve it sooner.
Could be because you didn't call any code that could throw.

Resources