Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Enterprise Tools / March 2004

Tip: Looking for answers? Try searching our database.

'System.FormatException' occurred in mscorlib.dll Additional information: Input string was not in a correct format.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tim Reynolds - 10 Mar 2004 21:11 GMT
Team

I have made this same post in .dotnet.languages.c#, but since it pertains to EIF & Logging Block, I decided to post here to the logging experts.  Please advise.  Thank you

I am receiving this exception

A first chance exception of type 'System.FormatException' occurred in mscorlib.dl

Additional information: Input string was not in a correct format

on this line of code

VOSEWebServicesIncomingEventSource.Raise(messageEvent)

where messageEvent is of type : Microsoft.ApplicationBlocks.Logging.Schema.AuditMessageEvent (from MS Logging Block
and was built with this code in preceding method (auditMessageEvent = messageEvent):

public static void PublishAuditEvent(string message, LogLevel logLevel, EventLogEntryType eventLogEntryType, CustomEventSource customEventSource
            AuditMessageEvent auditMessageEvent = new AuditMessageEvent();
            auditMessageEvent.Message = message
            auditMessageEvent.EventPublishLogLevel = (int)logLevel
            auditMessageEvent.EventLogEntryTypeID = (int)eventLogEntryType

and VOSEWebServicesIncomingEventSource is defined as

private static EventSource VOSEWebServicesIncomingEventSource = new EventSource("VOSE Web Services Incoming")

EventSource being of type Microsoft.EnterpriseInstrumentation.EventSourc

I have nothing else besides the exception to go from - I have no clue which string is really bad.

Please advise

Thanks
Tim Reynold
Verizon F
Mike Hayton [MS] - 10 Mar 2004 23:02 GMT
Hi Tim,

I see that its a first chance exception, does this mean that the exception
is being handled by the code?
How do you recieve this exception? (in the debugger with frist chance
exceptions turned on?)

Can you wrap the line of code with a

try
{
    VOSEWebServicesIncomingEventSource.Raise(messageEvent);
}
catch (Exception e)
{
  Console.WriteLine(e.ToString());
}

and send us the output? There may be no exception surfaced if it is handled
(caught) by the code somewhere within the Raise().
By default the Raise() will not throw - any internal exceptions are
ignored, but can be set to be output to the EventLog, or be thrown back up
to the code calling Raise().

FYI: Typically this System.FormatException happens in due to a call to
Enum.Parse(string) where you try to convert a string into its corresponding
enum type.

Cheers

Mike

--------------------
| Team,

I have made this same post in .dotnet.languages.c#, but since it pertains
to EIF & Logging Block, I decided to post here to the logging experts.  
Please advise.  Thank you:

I am receiving this exception:

A first chance exception of type 'System.FormatException' occurred in
mscorlib.dll

Additional information: Input string was not in a correct format.

on this line of code:

VOSEWebServicesIncomingEventSource.Raise(messageEvent);

where messageEvent is of type :
Microsoft.ApplicationBlocks.Logging.Schema.AuditMessageEvent (from MS
Logging Block)
and was built with this code in preceding method (auditMessageEvent =
messageEvent):

public static void PublishAuditEvent(string message, LogLevel logLevel,
EventLogEntryType eventLogEntryType, CustomEventSource customEventSource)
            AuditMessageEvent auditMessageEvent = new AuditMessageEvent();
            auditMessageEvent.Message = message;
            auditMessageEvent.EventPublishLogLevel = (int)logLevel;
            auditMessageEvent.EventLogEntryTypeID = (int)eventLogEntryType;

and VOSEWebServicesIncomingEventSource is defined as:

private static EventSource VOSEWebServicesIncomingEventSource = new
EventSource("VOSE Web Services Incoming");

EventSource being of type Microsoft.EnterpriseInstrumentation.EventSource

I have nothing else besides the exception to go from - I have no clue which
string is really bad.  

Please advise,

Thanks,
Tim Reynolds
Verizon FL

 
 


Signature

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Tim Reynolds - 11 Mar 2004 14:36 GMT
Mike
Thanks for your reply.  Yes I am in the debugger.  You ask if first chance was turned on. I don't see an option for first chance per say, but I have selected the option to break into the debugger for the 4 exception types noted on the Exceptions form (C++ Exceptions, Common Language Runtime Exceptions, Native Run-Time Checks, and Win32 Exceptions)

Can you please explain to me what first time exceptions are

Also, I ran with the piece of code you provided.  However, the catch block did not catch the exception...????  The code execution went from the raise to the break - skipping the catch block.  This I don't understand - if this is an exception - why isn't it being caught -??? -

However, I did use the Locals window to find the value in exception - Here is what it shows (sorry about the formatting)
-    $exception    {System.FormatException}    System.FormatExceptio
-    System.SystemException    {"Input string was not in a correct format."}    System.SystemExceptio
-    System.Exception    {"Input string was not in a correct format." }    System.Exceptio
    System.Object    {System.FormatException}    System.Objec
    _className    null    strin
    _COMPlusExceptionCode    -532459699    in
    _exceptionMethod    <undefined value>    System.Reflection.MethodBas
    _exceptionMethodString    null    strin
    _helpURL    null    strin
    _HResult    -2146233033    in
    _innerException    { }    System.Exceptio
    _message    "Input string was not in a correct format."    strin
    _remoteStackIndex    0    in
    _remoteStackTraceString    null    strin
    _source    null    strin
    _stackTrace    <undefined value>    System.Objec
    _stackTraceString    null    strin
    _xcode    -532459699    in
    _xptrs    0    in
    HelpLink    null    strin
    HResult    -2146233033    in
    InnerException    { }    System.Exceptio
    Message    "Input string was not in a correct format."    strin
    Source    null    strin
    StackTrace    null    strin
    TargetSite    <undefined value>    System.Reflection.MethodBas

What is also interesting is that the line is highlighted green.  Other real exceptions being thrown by my app are highlighting yellow.  Why is it green.  The line is the .raise method call in this code

    tr
   
        VOSEWebServicesIncomingEventSource.Raise(messageEvent)
   
    catch (Exception e
   
        Console.WriteLine(e.ToString())
   
    break

Thanks again

Tim Reynold
Verizon F

btw - 2 other exceptions I am receiving when starting my web services app in debug mode with breaks at every exception are

A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dl
Additional information: Access to the path "VOSE.WebServices.PDB" is denied. (I verified the file is there and is not readonly) - I get 5 of thes

A first chance exception of type 'System.ArgumentException' occurred in mscorlib.dl
Additional information: Error binding to target method. - I get 15 to 20 of these

Any ideas on these - or shall I open new posting?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.