System.Globalization.CultureNotFoundException in MVC projects - asp.net-mvc

In all MVC projects that I can remember (I'm now on version 3) I get the error:
A first chance exception of type 'System.Globalization.CultureNotFoundException' occurred in mscorlib.dll
appearing in the Debug Output pane when the project is run. Thus far I have ignored it because it seemed to make no difference, but ultimately I don't like errors appearing even if they have no apparent effect.

All exceptions are appearing in Debug mode, even those that are handled. When an exception is thrown in Debug model Visual Studio stops the execution and alerts you for this exception even if it is properly handled by your code. If a first chance exception is properly handled you can safely ignore it. You can disable first chance exceptions in Visual Studio.

Don't know if was a issue only in my machine, but enabling the following config, solved the case.
Debug -> Options -> Debugging and check Enable Just My Code (Managed Only)
StackOverflow Reference

Related

Debugging Xamarin.Forms iOS apps on Visual Studio using a Mac Agent

I am attempting to debug my Xamarin.Forms app through a Mac Agent on Visual Studio 2015. The iPhone Simulator works well but whenever it comes across an error VS (On Windows) always breaks at the same line, no matter where the error is in the code.
ie. on Main.cs This line:
UIApplication.Main(args,null,"AppDelegate");
The stack info is of no use either. The only way to find the actual error line is to put a break point and step through until it crashes. This is very slow and annoying.
Does anyone know a better way to debug on VS using a Mac Agent?
Thanks in advance
You can go to Debug->Windows->Exception settings and set Common Language Runtime Exceptions to be set. With that your code will break on every exception. Unfortunately, this will also break on exceptions in libraries so that will give you some noice, but this way helped me find some exception causes.

How to locate the origin of "Invalid floating point" exception without the debugger?

My system runs for hours without issues.
Suddenly it throws the invalid floating point exception.
It does not happen:
- While running in the debugger
- In all computers
How can I determine where the exception is thrown, without the debugger?
I use Delphi 6.
By combination of logging and exception tracing.
That would mean your system would have to be deployed with debug information. Does not seem a problem for you but sometimes is a problem for box software.
There are a lot of tools to do it, but maybe not all are Delphi-6 compatible still. To name a few:
Delphi obtain stack trace after exception
How can I obtain a stack trace without using third party components?
Display the call stack in a Delphi Win32 application
http://blog.synopse.info/post/2011/04/14/Enhanced-logging-in-SynCommons
So you would have to change default exception handler (in TApplication, ExceptProc or whatever - those tools in their sources would show you how to do it) and log floating point exceptions (you would hardly be interested in ALL the possible exceptions now).
This brings another question: a logging framework. Some libs above are already having it, some would need an extra library. You would already need it now and you would need it even more later.
Which logging library is better?
Good, free Delphi logging framework
https://mikejustin.wordpress.com/2012/09/12/delphi-and-free-pascal-logging-with-the-log4d-open-source-library/
Now you run your service for a while and it keeps saving all FP-related exceptions with their stack traces. IF you compiled it with some optimizations disabled (like "always generate stack frame") it would probably also show some local variables and parameters along the way.
If you re lucky - that would be enough for you to understand how the error happens. But most probably you would see the immediate error condition, but not how they developed from failed initial assumptions.
In that case you would at least have the stack trace (execution path) to the error (or few paths to a few similar errors that you know think being one).
At that point you shift your main effort into logging. Knowing your execution path you can log all the interesting functions parameter and local variables along the execution path and see how those variables get abnormal values before the logged exception (and how values are normal if now exception happens).
You would have to do several iterations, first expanding your search down the call stack, adding more params and vars to log, and maybe including some side-by routines to the logging, that are not directly in the call stack but were called before the exception and were affecting local vars values before the error.

Visual Studio 2013 holding on to the App_global.asax.PDB file?

Ever since upgrading to Visual Studio 2013 (From 2012), I've noticed that while debugging my ASP.NET MVC 5 app, I'll occasionally get a compiler error dump through IIS Express of:
Description: An error occurred during the compilation of a resource
required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: CS0042: Unexpected error creating debug
information file 'c:\Users\Jeff\AppData\Local\Temp\Temporary ASP.NET
Files\root\368a9040\83fb9039\App_global.asax.PDB' --
'c:\Users\Jeff\AppData\Local\Temp\Temporary ASP.NET
Files\root\368a9040\83fb9039\App_global.asax.pdb: The process cannot
access the file because it is being used by another process.
Source Error:
[No relevant source lines]
Source File: Line: 0
This error goes away if I open up Process Explorer and then search for the handle to App_global.asax.pdb (that DevEnv.exe has) and forcefully close it and then refresh the page. However, that's inconvenient and I've never had to do that before 2013.
Anyone have an idea on why this is happening intermittently on 2013 but not before?
The only possible thing I could think of was some obscure issue with Razor Generator's MSBuild step that I use, but I couldn't figure why it'd be on the App_Global.asax and not a view (and even then, it shouldn't be compiling for an unmodified view)
After upgrading to VS2013 we ran into this issue on a large webforms application that we develop. We solved it be removing the optimizeCompilations="true" attribute from on the compilation element in our Web.Config file.
I also tried VS2013 Update 1 and VS2013 Update 2 RC and neither of them resolve this issue.
I'm not sure if our issues are identical, but I solved the issue for me by disabling Edit and Continue.
Tools -> Options -> Debugging -> Edit and Continue -> Uncheck "Enable Edit and Continue" .

Delphi, Debug initialization section

My problem is that there is an Exception being raised in some part of the System, but it happens during initialisation and I can't figure out where or which exception it is. The system just begin to run and then it closes suddenly.
Do you have any methods to debug such a situation?
I am using Delphi5, just in case.
Download MadExcept. It works for Delphi 5, is free for non-commercial use (and is a definite bargain for commercial use), and works really well tracking down all sorts of mysterious exceptions.
Start the application with the F7 (step into) command, this will jump to the first unit initialization... you can then use the F7 or F8 as usual to debug any unit initialization section until you find the source of your exception.
This is sometimes a tedious work to debug the initialization... while you're making progress, you can put regular breakpoints in initialization sections to start again from a known point.
Have you get/found where the problem is after using those accepted answer (debugger tool)? Are you using lib/component that require some DLL? As my experience (exception doesn't appear and app closes suddenly); it is because something on your part unable load a DLL. The exception won't show in debug mode, but it'll appear when you just run the app (not in debug-Delphi).

Delphi 6 doesn't trigger breakpoints

After installation of Delphi 6 at new working station I issued problem with breakpoints. In debug mode environment doesn't trigger breakpoints like they are not placed at all...
Have you experienced similar situation? I suppose reason is some setting, but I cannot find which one...
TnX in advance!
Nemanja
Yes, this sometimes happens (not only in 6).
Enable all debug information except debug DCU's unless you want to debug the Borland code. (Don't forget to check for compiler switches in the code).
Disable code optimizer.
Rebuild all code.
If you are using DLL's be sure to enable debug code in all projects and set the host application to the right executable.
If that fails.
Be sure that there are blue dots at the code.
Be sure you have the right source file. You can check this by adding an error (for example dghasgsgd) and recompile, if the compiler accepts, this is not the right source file.
Be sure the code is reached (add a SendMessage statement or a message box so you can be sure the statement is reached.).
Restart the compiler. Or even restart the pc.
If that fails.
Take a break. Have a lunch or get something to drink.
Return and show the problem to a coworker. (preferably a programmer too).
I applied all settings that #Gamecat suggested, so you can look at this answer like short addition to previous answer.
I missed only one more to solve my problem. In Tools>Debugger Options I checked Integrated Debugging which alive my breakpoints. When breakpoints started to work, I got error message 'Project _.exe raised exception class EAccessViolation with message 'Access violation at address 4CDEB080 in module 'IDPDX32.DLL'. ' For solving this issue I just unchecked option 'Stop on Delphi Exceptions' in menu Tools>Debugger Options>Language Exceptions.
Now Delphi works fine and don't need to reinstall it.
Reason for loosing my previous configuration that worked fine might be in copying my files from one folder to another (as well as config and other temp files) when paths became wrong and after that I probably deleted old config files and started with settings from beginning...
+1 Tip: If you get this message: [Error] RLINK32: Unsupported 16bit resource in file ....\estands\estandar_StdFormMainFrm.DFM problem is in Text-DFM option. When you right-click on the form in the IDE, is the menu item "Text-DFM" (or maybe called "Text as DFM") checked? If not, do so, save and try to compile.
If somebody knows reason for this behaviour, detailed explanation would be useful. Until now I found this option is for backwards-compatibility to older Delphi-versions.

Resources