Hi there,
I'm wondering is there any way i can gracefully handly the
System.IO.FileNotFound exception.
Let me explain my situation.
I've got a window forms app.
I've exception handlers for
AppDomain.CurrentDomain.UnhandledException
and for
Application.ThreadException
and and a try catch around my Main/Submain
Ok this is the right way to go for handling all expcetions on windows froms
from what i read.
However displaying my exception i call something like
MyTrace.Trace(excepction);
ok so still everything fine no problems..
Unless the missing assebmly that i'm trying to load is the MyTrace assembly.
Obviously i cannot use MyTrace assembly to trace that it's not there!
So what can I do?
I though ok, i can live with letting FileNotFoundExceptions being handled
with a MessageBox.Show, so where i handle the exceptions i do something like
if (excpetion is FileNotFoundException)
MessageBox(..);
else
MyBase.Trace(exception)
However I'm still getting problems. I don't know if it's the just in time
compiler or what but if MyTrace assembly is missing then i don't get the
message box!!?
It's like the Application sees that .. hey i may use MyTrace assembly better
load it.
And it seens to happen outside my try/catch/unhandled excptions
Anyone seen this before or know how to fix it? 4 2493
Hi,
Why don;t you check for the file existence:
File.Exist( path )
You could ask for the user to enter another file
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Brian Keating" <Br**********@discussions.microsoft.com> wrote in message
news:A3**********************************@microsof t.com... Hi there,
I'm wondering is there any way i can gracefully handly the System.IO.FileNotFound exception.
Let me explain my situation.
I've got a window forms app.
I've exception handlers for AppDomain.CurrentDomain.UnhandledException and for Application.ThreadException and and a try catch around my Main/Submain
Ok this is the right way to go for handling all expcetions on windows froms from what i read.
However displaying my exception i call something like MyTrace.Trace(excepction);
ok so still everything fine no problems.. Unless the missing assebmly that i'm trying to load is the MyTrace assembly.
Obviously i cannot use MyTrace assembly to trace that it's not there! So what can I do?
I though ok, i can live with letting FileNotFoundExceptions being handled with a MessageBox.Show, so where i handle the exceptions i do something like if (excpetion is FileNotFoundException) MessageBox(..); else MyBase.Trace(exception)
However I'm still getting problems. I don't know if it's the just in time compiler or what but if MyTrace assembly is missing then i don't get the message box!!? It's like the Application sees that .. hey i may use MyTrace assembly better load it. And it seens to happen outside my try/catch/unhandled excptions
Anyone seen this before or know how to fix it?
Hi Ignacio,
thanks for you help, but the file that doesn't exist is actually an assembly
that is in the gac so a simple File.Exists won't work.
Thanks for your help though
brian
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
Why don;t you check for the file existence:
File.Exist( path )
You could ask for the user to enter another file cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Brian Keating" <Br**********@discussions.microsoft.com> wrote in message news:A3**********************************@microsof t.com... Hi there,
I'm wondering is there any way i can gracefully handly the System.IO.FileNotFound exception.
Let me explain my situation.
I've got a window forms app.
I've exception handlers for AppDomain.CurrentDomain.UnhandledException and for Application.ThreadException and and a try catch around my Main/Submain
Ok this is the right way to go for handling all expcetions on windows froms from what i read.
However displaying my exception i call something like MyTrace.Trace(excepction);
ok so still everything fine no problems.. Unless the missing assebmly that i'm trying to load is the MyTrace assembly.
Obviously i cannot use MyTrace assembly to trace that it's not there! So what can I do?
I though ok, i can live with letting FileNotFoundExceptions being handled with a MessageBox.Show, so where i handle the exceptions i do something like if (excpetion is FileNotFoundException) MessageBox(..); else MyBase.Trace(exception)
However I'm still getting problems. I don't know if it's the just in time compiler or what but if MyTrace assembly is missing then i don't get the message box!!? It's like the Application sees that .. hey i may use MyTrace assembly better load it. And it seens to happen outside my try/catch/unhandled excptions
Anyone seen this before or know how to fix it?
Hi,
Ok, if the file is in the GAC then you cannot use File.Exist and I think
that the problem is that your application never is executed, as the runtime
try to load all your assemblies before running the app.
What if you load the assemblies with your code, in this way you will know if
any or which assembly failed to load.
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Brian Keating" <Br**********@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.com... Hi Ignacio, thanks for you help, but the file that doesn't exist is actually an assembly that is in the gac so a simple File.Exists won't work.
Thanks for your help though
brian
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
Why don;t you check for the file existence:
File.Exist( path )
You could ask for the user to enter another file cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Brian Keating" <Br**********@discussions.microsoft.com> wrote in message news:A3**********************************@microsof t.com... > Hi there, > > I'm wondering is there any way i can gracefully handly the > System.IO.FileNotFound exception. > > Let me explain my situation. > > I've got a window forms app. > > I've exception handlers for > AppDomain.CurrentDomain.UnhandledException > and for > Application.ThreadException > and and a try catch around my Main/Submain > > Ok this is the right way to go for handling all expcetions on windows > froms > from what i read. > > However displaying my exception i call something like > MyTrace.Trace(excepction); > > ok so still everything fine no problems.. > Unless the missing assebmly that i'm trying to load is the MyTrace > assembly. > > Obviously i cannot use MyTrace assembly to trace that it's not there! > So what can I do? > > I though ok, i can live with letting FileNotFoundExceptions being > handled > with a MessageBox.Show, so where i handle the exceptions i do something > like > if (excpetion is FileNotFoundException) > MessageBox(..); > else > MyBase.Trace(exception) > > However I'm still getting problems. I don't know if it's the just in > time > compiler or what but if MyTrace assembly is missing then i don't get > the > message box!!? > It's like the Application sees that .. hey i may use MyTrace assembly > better > load it. > And it seens to happen outside my try/catch/unhandled excptions > > Anyone seen this before or know how to fix it?
hi again,
thanks for you help,
in the end i loaded my Diagnostic Library in the case of an unhandled
exception and this did the trick.
Thanks
Brian
"Ignacio Machin ( .NET/ C# MVP )" wrote: Hi,
Ok, if the file is in the GAC then you cannot use File.Exist and I think that the problem is that your application never is executed, as the runtime try to load all your assemblies before running the app.
What if you load the assemblies with your code, in this way you will know if any or which assembly failed to load.
cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation "Brian Keating" <Br**********@discussions.microsoft.com> wrote in message news:D1**********************************@microsof t.com... Hi Ignacio, thanks for you help, but the file that doesn't exist is actually an assembly that is in the gac so a simple File.Exists won't work.
Thanks for your help though
brian
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,
Why don;t you check for the file existence:
File.Exist( path )
You could ask for the user to enter another file cheers,
-- Ignacio Machin, ignacio.machin AT dot.state.fl.us Florida Department Of Transportation
"Brian Keating" <Br**********@discussions.microsoft.com> wrote in message news:A3**********************************@microsof t.com... > Hi there, > > I'm wondering is there any way i can gracefully handly the > System.IO.FileNotFound exception. > > Let me explain my situation. > > I've got a window forms app. > > I've exception handlers for > AppDomain.CurrentDomain.UnhandledException > and for > Application.ThreadException > and and a try catch around my Main/Submain > > Ok this is the right way to go for handling all expcetions on windows > froms > from what i read. > > However displaying my exception i call something like > MyTrace.Trace(excepction); > > ok so still everything fine no problems.. > Unless the missing assebmly that i'm trying to load is the MyTrace > assembly. > > Obviously i cannot use MyTrace assembly to trace that it's not there! > So what can I do? > > I though ok, i can live with letting FileNotFoundExceptions being > handled > with a MessageBox.Show, so where i handle the exceptions i do something > like > if (excpetion is FileNotFoundException) > MessageBox(..); > else > MyBase.Trace(exception) > > However I'm still getting problems. I don't know if it's the just in > time > compiler or what but if MyTrace assembly is missing then i don't get > the > message box!!? > It's like the Application sees that .. hey i may use MyTrace assembly > better > load it. > And it seens to happen outside my try/catch/unhandled excptions > > Anyone seen this before or know how to fix it? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: ulf |
last post by:
Hello,
After I got a FileNotFoundException in my real life CSharp code, I nailed it
down to the following line:
System.EnterpriseServices.ResourcePool rp = new...
|
by: Karl Hungus |
last post by:
A cs file I compiled into an assembly dll is in my bin directory. In the cs
file I have a using statement for System.Xml
I compiled it using this command: csc /out:XmlContent.dll /t:library...
|
by: MattC |
last post by:
Hi,
I am getting the following error:
System.IO.FileNotFoundException:
C:\Dreamtxt\WebSites\mysite\www\feedback.aspx at
System.Web.UI.TemplateParser.GetParserCacheItem() at...
|
by: Eric van Wijk |
last post by:
Hi All,
After installing SP1 for Windows 2003, I'm running into the 'Error
loading type library/DLL' exception when using CDO through System.Web.Mail:
...
|
by: James |
last post by:
Hi guys
Do you ever get the exception in Managed C++? How can I know which file or
dll is missed?
|
by: Peter Vestergaard |
last post by:
Hi, I am running VS .Net 2005.
I have an application in which one of the classes are having a member that
is an instance of a class defined in a managed C++ dll. As soon as I try to
create an...
|
by: kkizer |
last post by:
I have a problem with this simple code below. Moving the files works
perfectly, but once in a blue moon the file that it is trying to move
dissapears before it can move it. and when this happens...
|
by: jjlagtap |
last post by:
Hey everyone
When I try to open a file i get the Exception listed below. The weird thing is it works when I run the web app locally and when i use a remote server and open a file on my computer....
|
by: =?Utf-8?B?c2FtMDFt?= |
last post by:
I have a remoting application that was developed on a Windows XP SP2 machine
with VS2005 SP1. I finally got everything deployed using Wix 3.0, and it
works great. Problem is, when I install the msi...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |