|
Hi,
I am using unmanaged Dll in a managed C# project, where callbacks are made from the unmanaged code to the managed code.
My project compiles fine, when I run the application (in debug mode), which is basically a client that communicates with a server application, intermittently I get a NullReferenceException dialog box. But my problem is it does not point to a specific line of code where this exception is occurring. The dialog just shows in the middle of the IDE (VS 2008) and I have to stop the application.
Does anyone know how can I verify where this exception is occurring???
Appreciate your suggestions.
|
|
|
|
|
This happens sometimes when error is happening to an external dll. Say you have added a dll called a.dll which doesnt have the pdb associated with it or no Debug Symbols for that dll is loaded into memory... Thus .NET cant show you the actual source, and hence shows this error.
You can see the assembly code.. but if you dont know it, it wouldnt be meaningful to you.
What you can do is always add the dll from bin folder of your project. This ensures that the dll is loaded with debug symbols.
|
|
|
|
|
I have added the dll from bin folder of the project.
modified on Sunday, September 20, 2009 4:43 PM
|
|
|
|
|
I mean I have been doing that already before I posted this question, It did not help.
|
|
|
|
|
try copying both the DLL and the PDB file to the EXE folder.
that may suffice to get line numbers in your exception.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Both of them are in the "bin\x64\Debug\" along with the EXE.
|
|
|
|
|
What exactly the operation you are doing when you encounter this exception..??
the line no is not shown only when the source is not associated with debug information..
Debug line by line to find exact line where error is occurring..
Also see if there is anything in InnerException (Though I think it should be null)
|
|
|
|
|
|
nicromonicon wrote: is there such a thing?
And this relates to C# how?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
actually i didnt know where to post it, its network related but i couldnt find network category
|
|
|
|
|
So why on earth did you pick C#? It looks like you just picked a random forum, which isn't going to get you an answer. You might as well have asked this in Pig Farmers Weekly. You could have chosen the General IT Issues or, more appropriately, the Hardware and Devices forum.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
i did it because i wanted to know - also - how to connect to a proxy via C#
anyway-Mr.O'Hanlon-dont you think by the time it took you to write down those not-so-funny rants and cheap jokes, you could've answered my question instead?
a true professional would have answered my question, or at least guide me to the correct forum
so next time, if you do know the answer,by all means, if you dont, please refrain from making useless comments..other members are not here for the jokes
|
|
|
|
|
nicromonicon wrote: i did it because i wanted to know - also - how to connect to a proxy via C#
Then you should have stated that, and not asked an unrelated question. We can't read your mind for you.
nicromonicon wrote: anyway-Mr.O'Hanlon-dont you think by the time it took you to write down those not-so-funny rants and cheap jokes, you could've answered my question instead?
No I don't. This isn't the right forum for this - think about it for a minute. People search these forums for answers to questions; why do you think that somebody would look for a network question in the C# forum? It makes no sense.
nicromonicon wrote: a true professional would have answered my question, or at least guide me to the correct forum
And had you read my reply you'd see that I suggested two possible forums for you.
Anyway, I'm not going to bother reading your replies now - whenever somebody replies in the way you just have, it's apparent they are incapable of a rational dialogue.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
nicromonicon wrote: other members are not here for the jokes
Oh yes we are 
|
|
|
|
|
In Crystal report viewer, is there any way to rename the tab [Main Report] showing at the top of the report to any name which I will decide?
|
|
|
|
|
i have the following field:
trxn_date
trxn_category
trxn_description
trxn_total_amount
trxn_discount_amount
trxn_net_amount
I want to display a monthly report (all above excep trxn_category) based of the selected month so it will list by days from 1 to last day of the month.
at the bottom, I want to display the list by category for the whole month (without trxn_date and trxn_description) so it will be:
trxn_category
trxn_description
trxn_total_amount
trxn_discount_amount
trxn_net_amount
can you please guide...
|
|
|
|
|
Let me know what reporting engine you are using... Is it Crystal Report, Microsoft Reporting (RDLC) or any other??
In any case just make grouping to those elements and place the group elements in the group footer. Use appropriate functions, and I think it will adjust automatically.
|
|
|
|
|
Hi guys,
I have this code in my form1_load event:
RegistryKey licenseCheck = Registry.LocalMachine.OpenSubKey(@"software/openorganise");
string licenseCo = licenseCheck.GetValue("tlb").ToString();
DateTime licenseDate = Convert.ToDateTime(licenseCo);
if (licenseDate.AddDays(30) == System.DateTime.Now)
{
MessageBox.Show("Your OpenOrganise License Has Expired. Please Purchase A New One.", "OpenOrganise Message.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
Application.Exit();
}
now, ive got a config value that sets it to write to a file if its the first time run or not, etc etc, this works fine, in the event of a first run i have:
RegistryKey licenseKey;
licenseKey = Registry.LocalMachine.CreateSubKey(@"Software\openorganise");
licenseKey.SetValue("tlb",DateTime.Now);
Registry.LocalMachine.Flush();
However, when running the application i get: "object referance not set to a instance of a object"
Im stumped to as why. I even went and manually made the reg key.
thanks,
Ben.
|
|
|
|
|
Hi,
some remarks:
1.
exceptions tend to contain a lot of information, however you need to look at all of it, i.e. use Exception.ToString() instead of Exception.Message
one of the pieces of information it offers is a filename and linenumber; that would point straight to the culprit line. Also teach your IDE to always show line numbers in edit windows, see here[^].
2.
Recent Windows versions don't allow a regular user to access/modify system settings that would extend to other users; the LocalMachine registry hive would be in that category.
3.
Your expiration test needs a less than comparison, not an equals. DateTimes seldom are equal as they contain information up to the tick (one tenth of a microsecond).
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I can only speculate on this but if the statement
licenseKey = Registry.LocalMachine.CreateSubKey(@"Software\openorganise");
fails for any reason then licenseKey will be uninitialised.
|
|
|
|
|
Ben Magee wrote: OpenSubKey(@"software/openorganise");
Ben Magee wrote: CreateSubKey(@"Software\openorganise");
Should these both be backslash?
Alan.
|
|
|
|
|
Thanks for the feedback, I will look into all these issues now.
Could you please give a example of a lessthan statement in the current context im using?
thanks,
Ben.
|
|
|
|
|
if (1 < 2) MesageBox("one is less than two");
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
After changing my registry edits to CurrentUser and changing to backslashes im still getting my exception error.
I also changed
System.DateTime.Now;
to
system.DateTime.Today;
would that work any better?
Cheers,
Ben.
|
|
|
|
|
use the line numbers as I've told you, and learn to debug your code yourself. This thread already is a lot longer than the code it is about...
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|