Getting object reference error in my MVP application - mvp

I am receiving random object reference error in different modules of my application.The errors m facing is intermittent. I did debug of my code it looks all correct. Moreover, whenever I run into that error and I try again (immediately after I got error) with same steps with same input conditions that error does not come up. This is something which is happening not only in in development regions but also in production regions. I tried to analyze and I got some leads that there might be problem with temporary ASP. But I don't know how that can cause object reference errors. Sometimes I see Source error information like App_Web_ighjds[some kind of ID I guess]. I don't know where exactly the problem is? As far as my code is concerned It looks all fine. I believe if there was problem with my code then it should be reproducible every time. Does anybody have any idea why such error might be happening? If it is issue with temporary asp.net files then what I should do to avoid such error?? Any help is much appreciated. Thanks.

You're looking for ideas: I would suspect your module initializers or any DI container initialization.
Look for code that runs only on application start.
I would recommend to reset your web server completely before starting new debugging session.
I would also recommend setting Visual Studio debugger to "Break when an exception is thrown", by going to "Exceptions" settings (Ctrl-Alt-E) and checking the "CLR Exception" "Thrown" checkbox.

Related

"Attempt by security transparent method" when re-opening a default application

I created a new application with react native windows, and it works well the first (few) times I run it, however, when closing the application I always end up with the following warning:
Attempt by security transparent method 'System.Reactive.Concurrency.CoreDispatcherScheduler..ctor(Windows.UI.Core.CoreDispatcher)' to access security-critical type 'Windows.UI.Core.CoreDispatcher' failed.
I've tried this on more than one computer and all of them get the same error but I can't find a way to fix this, meaning I cant proceed with my Native project in fear that it will malfunction every day.
How do I fix this, to stop this from happening again, or is it a bug?
I'm a novice in React Native myself, but here are a few suggestions:
1) There's an issue logged in GitHub on this exact problem: https://github.com/Microsoft/react-native-windows/issues/1954
2) I personally find that I get this with command-line execution (react-native run-windows) but I don't think(?) that I've seen it when running from inside Visual Studio. Try that approach to running instead.
3) As described at GitHub - I've found that deleting windows\Debug folder before running tends to resolve the issue.

Scintilla error message on unrelated code

First off, ScintillaNET v2.6 was installed as a control and I have been able to use it and compile, so I assume the installation is ok:
This app is targeting the full .NET 4.0 framework, not the client profile)
Environment variable
ScintillaNT folder content
The error message:
The code triggering the error:
The error happens on the second line when I "step-in" the load method. Looks completely unrelated, but highly reproducible: the error always happens at that exact step.
The problem turned out to be a corrupted XML file. I still don't know why the crash page was all about ScintillaNET, but it appears this had nothing to do with Scintilla.
I am not deleting this question because I could not find any indication that this could happen (errors in different parts of the code triggering a Scintilla error page) and it would have saved me a lot of time trying to track back the "scintilla" problem.

no error messages in xcode?

I'm coming from using visual studio. When I run in XCode and I get an error, it just says something like SIGABRT, but there are no helpful error messages like in VS, it doesn't point me to any code. There is just a list of memory addresses and threads.
How do I make it display messages like VS?
You put in your own error catchers, or use breakpoints. There's no way to make it give you helpful error messages. The best you can usually do is figure out which line it failed on, through trial and error using breakpoints.
You should look at Exception Breakpoints. Usually you want to add an exception throw Breakpoint to see which line threw the exception. More details in this answer: Xcode doesn't show the line that causes a crash
You should also always scan your code for errors and post some code! If you don't post code, most of the times nobody will be able to help you, especially when the problem is a code related crash.

Triggered brakepoint without having any

MyProject has triggered breakpoint
without any brakepoints in my project (i have made sure using Debug/Delete all BP)
I do not really post some code, because project is really big and it is also impossible to make some minimal sample.
Where sould I look when getting this error?
TY
I had a similar problem recently, where it was stopping on a breakpoint that no longer existed, and my Code Coverage highlighting was reflecting an older run, somehow. Not sure why, but things were out of sync between what was current state and what it was previously. For my instance, I was able to do a Clean Solution, then shutdown and restart VS 2010 and the problem went away.
Has only happened to me the one time, so I am not sure what I could have done to cause it. Didn't see anything similar logged on Connect, either.
Your debugger might be set to break when an exception is thrown.
Go to Debug -> Exceptions... -> make sure all the boxes are unchecked.
Without any more info I can't help...

How to debug a program that doesn’t throw any error

I’m having trouble to find a bug in my application.
The problem is random and don’t throw any error. The web site just keeps loading and loading and eventually gets a timeout.
Is a web application using MVC 3 in VS 2010 Pro.
Some time ago, I see a friend to write something in the url, and gets all the trace of the program…
Sadly, I don’t remember what the command was.
Anyone has an idea of what command is it?
Any suggestion on what to use to debug?
Thanks!
Edgar.
UPDATE!
I finally found the command... is trace.axd
But Its behave the same way... sometimes load without problems and show me all the trace info... and sometimes.. it keep loading and loading...
Maybe something related with IIS?
Turn on break on every thrown exception, run your application in debug mode and wait. If it executes too long then pause application and check where you are or wait for exception that is handled somewhere.
Your friend may have had something like the following built into his application, to dynamically set tracing on.
Trace.IsEnabled = Request.QueryString["trace"] != null ? true : false;
This provides info only if the page is fully loaded. It's probably best if you use the VS debugger to step through code.
If all you loops look ok, investigate code that could result in circular references or deadlocks. These can be difficult to spot sometimes, look for functions or constructors that require results from a calling class. So code that needs the result from a function which in turn need results from the first.
Well, this sounds like you have an infinite loop somewhere.
Look at the code that runs when you visit the URL that gives you trouble. See if there is any loops in there (for/while). If yes, see why if they never exit. You can do this by putting a breakpoint inside the loop and examining its behavior over the iterations.
in MVC the bugs you do not see are most of time (especially in Razor and Ajax work) view compile errors. Sometimes syntax bugs on views just does not show that view and do not stop working.
Try that:
put a breakpoint in view.
If program stops in there it means this view is working. Othervise there is a syntax error in this view.
Another way to see some bug information more than in visual studio is use browser tools.
I use google Chrome. Just open developer tools in it. Open network. And do your request. It will list the requests and responses. Click the response and see the information. After style (it is written Verdana etc) read exception details. Sometimes there is more information :)
I am using MVC 3 in Razor from start. So this is a small bug in asp.net mvc.

Resources