Reputation:
First of all, I'd like to say that this site is great!
My question is, what are the reasons for the following 2 error messages?
1) In VB.NET (I know this is a C# forum but my next question is from C# experience), property evaluation failed (I do this when putting a watch on an exception variable).
2) In C#, method or class (Can't remember which) does not have a constructor. I think I got this with HttpContext or HttpApplication, which is a class if I remember correctly? Pretty sure it is as it has its own properties and methods.
Thanks
Upvotes: 0
Views: 597
Reputation:
First of all, apologies for making a duplicate thread (couldn't see this one so made another).
1) That makes sense. Watching datetime.now for changes will just display the time @ the time of adding a watch, cache that value, and then get the new value (Time) when checking again.
2) John Rudy: you are spot on. That is what I was doing. So HttpContext.Current gives me back the httpcontext object to work with, I see.
Upvotes: 0
Reputation: 37850
I'd probably want to see code snippets to give you real answers, but my psychic detection powers are telling me that #2 is most likely that you are trying to do something like:
HttpContext context = new HttpContext;
This isn't the way you'd approach that. Instead, you would use its built-in factory method to access the current one:
HttpContext context = HttpContext.Current;
(Ditto for HttpApplication.)
I can't help with #1 without seeing some representative code. And don't worry, this isn't a C#-specific forum, it's for all programming languages and platforms. :)
Upvotes: 2
Reputation: 1500525
1) Could be any number of reasons. Some properties just don't work nicely in a debugger. (Imagine watching DateTime.Now for changes!)
2) You're trying to create an instance of a class which doesn't have an appropriate accessible constructor. Usually either the class only has static members, or there's a static member you're meant to use to get an instance. (Having said that, both the classes you've mentioned have public constructors.)
More precise error messages and situation descriptions would be helpful.
Upvotes: 3