|
The full version of .NET Framework does not implement code pitching (discarding JITted code). Only .NET Compact Framework currently does this. See http://msdn.microsoft.com/en-us/library/ms231445.aspx[^] for a note on this.
Do watch out for dynamic assemblies for XML serialization, which if I recall correctly can end up being repeatedly recompiled if you don't use the right options to cache the serializer assembly. These are built by generating C# code and invoking the C# compiler so their cost is very high indeed. See XmlSerializing your way to a Memory Leak[^].
Otherwise, be sure you're disposing all objects you use which have a Dispose method or implement IDisposable . If you don't, the object's finalizer may need to be run, which causes it to survive the first GC and pushes it into an older generation. See "Finalization and Performance" in Garbage Collector Basics and Performance Hints[^].
Finally, for tools, FxCop will tell you if you haven't called Dispose on your member variables in your class's Dispose method, if your member variables implement IDisposable. To follow what allocations are happening where, try CLR Profiler[^].
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Thanks Mike, plenty to chew on here!
Regards
Ray
"Je Suis Mort De Rire"
Blogging @ Keratoconus Watch
'Cos the righteous truth is, there ain't nothing worse than
some fool lying on some Third World beach wearing
spandex, psychedelic trousers, smoking damn dope
pretending he gettin' consciousness expansion. I want
consciousness expansion, I go to my local tabernacle
an' I sing with the brothers and sisters -- Alabama 3
|
|
|
|
|
I downloaded and installed dotnetfx2 but none of the dll's are showing up in the references list (add references to a project) in the IDE.
I have xp sp2 and visual studio 2003
Any suggestions?
Steve S.
|
|
|
|
|
sas9491 wrote: Any suggestions?
Install Visual Studio 2008 (possibly one of the free editions if your budget doesn't stretch to a fullblown version). The problem you've got is that you are trying to see .NET 2 from an application that only recognises .NET1.1. You need a minimum of VS2005 before you can see .NET2.
|
|
|
|
|
Thanks Pete, That was the issue. The world is spinning in greased grooves once again.
Experience is know you've made this mistake before
|
|
|
|
|
Along with what Pete said;
VS2003 is only meant to build against 1.0 and 1.1. Microsoft makes money by creating newer versions that have newer features that can't be run on older systems. You have to update to VS2005 at the minimum or just skip to VS2008.
VS2005 only allows you to see the .NET 2.0 assemblies (partially because the functionality is kept from 1.0 and 1.1), but you cannot build applications to 1.0 or 1.1 framework. With the WinFX (now .NET 3.0) extensions you can build and see the .NET 3.0 framework.
VS2008 is meant to work/build to either .NET 2.0 or .NET 3.0 or .NET 3.5 (you will see all of those assemblies). You can't see/build to 1.1 or 1.0 frameworks.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Have anyone used Word viewer ocx ? (available here at :http://www.anydraw.com) I have downloaded its evaluation version and it works fine . Will this version become expired so that I need to purchase it ? Because when using this component there is no sign of alert saying it is an evaluation version. Has anyone used this component knowing the answer ?
|
|
|
|
|
It has a buy now option on the website, so what do you think (especially as it has a selling price of £535.86)?
|
|
|
|
|
Hey, everyone. I ran into a little puzzler this morning that took me back to my early days of OOP, and I'd appreciate it if someone could point out what I'm failing to understand.
I was attempting to check the values of two System::Drawing::Point objects for equality, and the equality operator did not behave as I expected. Now, before you jump all over me about it, I do understand the difference between using the virtual method Object::Equals() and the equality operator '==' on two handles. Well, at least, I thought I did until I decided I might just be crazy a few minutes ago.
I know that operator== will only check to see if two handles refer to the same instance unless it is overridden to do value checking instead, but it is overridden for the Point class. MSDN reports that System::Drawing::Point::operator==() "compares two Point objects. The result specifies whether the values of the X and Y properties of the two Point objects are equal."
My silly little test case (in C++/CLI) follows:
Point^ p1 = gcnew Point(0, 0);
Point^ p2 = gcnew Point(0, 0);
label1->Text = (p1 == p2).ToString();
label2->Text = (p1->Equals(p2)).ToString();
Label1 reads "false" and label2 reads "true," which is the behavior I would expect if the Point class didn't override operator==, but it appears to. I've Googled around and searched through a few forums, but haven't found anyone complaining of the same issue.
I know this just has to be some silly little error that I'm making, either in implementation or understanding, and I'm going to be embarrassed when someone smacks me with the clue bat. I'd much rather understand and be embarrassed than continue to misunderstand, though.
Thanks, gang, and try to be gentle.
|
|
|
|
|
With my minimal C++ knowledge, the code you supplied is working how it is suppose to (in C++). I could understand if MSDN was making reference to the VB or VC# aspects of the == operator. If you are sure the MSDN article was for C++, then the only thing I can say is "Microsoft is only perfect" (try not to laugh to hard at the statement). Microsoft and its employees could have been mistaken in that aspect (wouldn't be the first time).
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
I went digging around MSDN again to give you a link to what I was looking at when I figured out where I was being a doofus.
System.Drawing.Point is a value class. When I did Point^ p1 = gcnew Point(0, 0); , a new Point value was created, then immediately boxed so the handle p1 could refer to it. p1 == p2 was then operating on Point handles, not Point values.
Here's another little snippet:
Point p1 = Point(0, 0);
Point p2 = Point(0, 0);
Point^ hp1 = p1;
Point^ hp2 = p2;
this->label1->Text = (p1 == p2).ToString();
this->label2->Text = (hp1 == hp2).ToString();
I really should have known that, I mean, it's pretty basic stuff. I do feel better now that I figured it out, though. Sorry for the board, clutter, gang!
|
|
|
|
|
Hello all. I am in dire need of some help. I have a project that I need to complete STAT! Here is the rundown:
I have a form. This form has six controls on it. They do nothing.
I have another form that retrieves these these control in a Control[] array.
On this second form, there is a comboBox and a richTextBox.
The comboBox is populated with the names of the controls.
I have absolutely no problem getting the names of the properties; I can get them fine.
I cannot get the value of each of these properties. I know that there is a GetValue(object, object[] index) method that is supposed to return the value of a property, but I can not get it to work to save my life!
I have included the code from the SelectedIndexChanged event of the combobox, and the class that represents a property below. Assume that the rest of the program works because it does.
If the GetValue call is dropped off the end of the last line below, all of the properites' names are properly listed in the textBox.
Please show me how I should call this method. Any sugestions would be greatly appreciated!
private void myCboBox_SelectedIndexChanged(object sender, EventArgs e)
{
//creates an int to hold the selected index:
int index = myCboBox.SelectedIndex;
//creates a type variable:
Type t = controls[index].GetType();
MyProperty Myproperty = new MyProperty(t.Name, null);
PropertyInfo[] myProps = t.GetProperties();
foreach (PropertyInfo p in myProps)
{
richTextBox1.Text += "\n" +
//The GetValue call is whats killing me!
//Throws a TargetException
//Going crazy here! Please help!
p.Name + "\t\t\t\t" +p.GetValue((object)Myproperty, null);
}
}
}
public class MyProperty
{
public MyProperty(string aName, object aValue)
{
theName = aName;
theValue = aValue;
}
private static string theName;
public static string theNameProp
{
get { return theName; }
set { theName = value; }
}
private static object theValue;
public static object intTest2
{
get { return theValue; }
set { theValue = value; }
}
}
"If you don't know where you're going, you'll probably end up somewhere else." Yogi Berra
|
|
|
|
|
In your foreach loop:
1) p is a PropertyInfo of Type t
2) you call p.GetValue with an instance of type MyProperty, which is probably not of type t
Therefore the exception.
You should call GetProperty with the instance from the controls collection, where you get the type from.
regards
Urs
-^-^-^-^-^-^-^-
no risk no funk
|
|
|
|
|
Try p.GetValue(Myproperty, null) instead of p.GetValue((object)Myproperty, null). The is no need to cast Myproperty to an object since its already an object.
|
|
|
|
|
I have an application which is converted from VC6 to VC7.1 (.net 2003)
I'm trying to debug in .net 2003 i need to check the return value HRESULT value. I have declared hr as
HRESULT hr = S_OK;
When i add "hr" in watch window it displays a message CXX0017: Error: symbol "hr" not found
When i try to set the cursor on HRESULT hr = S_OK line (using Set Next Statement) it does not execute that line.
Could you please let me know what could be the reason? and why cant i see the hr value.
Thanks
|
|
|
|
|
You're really in the wrong forum. You should generally ask C++ questions in the Visual C++/MFC forum[^]. This forum (.NET Framework) is for general managed code, e.g. Visual Basic or C#, non-language-specific questions.
That said, most likely you're trying to debug a release build. The optimizer has most likely optimized away the hr variable, leaving its value only in a variable. Or, if you're never writing to it, just replacing it everywhere it's used with the static value 0 (which is the value of S_OK).
Always debug a non-optimized, debug build of your application to begin with. It's important to test release builds but I'd generally only load one into the debugger if there's a problem that doesn't reproduce in the debug build.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hello,
I am new to .net framework. Previusoly i was working in VC++. When i see the applications in .net, all code is in ".h" file not in ".cpp" file.
Why this, i am confusing about this.
|
|
|
|
|
In C# (and VB.net as far as I know) you do not have seperate header and implementation files. You have only one (e.g. .cs on C#) for normal code. This file contains for example the class with its interface and implementation in one place.
There can exist several files when classes are marked partial (normally used for classes that are partly auto-generated).
regards
Urs
-^-^-^-^-^-^-^-
no risk no funk
|
|
|
|
|
I need a text editor with the ability of editing .RTF files (if not word files) . Something like TE Edit Control.(You can find it in http://www.subsystems.com site). But I want it to be free or have its crack ) I really need this for a project.
Best Regards , Hossein
|
|
|
|
|
devboycpp wrote: have its crack
So, you're a thief and you're hoping we will help you ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
devboycpp wrote: have its crack
If you are going to use this in your project, let me know of your organization name and project manager so that I can report them to Intellectual Property Rights organization of your country.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Since I do actually help people on the odd occasion....
Google
EditPad Lite
-= Reelix =-
|
|
|
|
|
This seems so silly, but,
I've been googling now for 2 hours and can't find an answer. Hope someone here can help.
I create a temp directory on the path Environment.SpecialFolder.LocalApplicationData combined with a session guid. No problem - the directory is created. The problem is that the 'Use folder type as a template:' (Explorer directory-properties-customize) is set by default on the create to 'Pictures and Videos' or 'Music' and I was wanting it to be set to 'All items'. (The folder look is incorrect on Process (verb 'open') explorer load.)
Any help for the call to change the folder type would be greatly appreciated. (I'm running on Vista with VS2005).
Thanks.
|
|
|
|
|
Strange Behavior with Generics:
When I define a Generic at class level with a constraint, I get a compile exception , however , when I implement Generic at method level with the same constraint , all goes well ...
Wondering , wether its a bug in generics or the bug lies in my way of interpretation
Have Tried to explain the problem below :
Case 1:
I have defined a abstract generic class and defined the generic type at class level , with a constraint . Below is the class definition.
public abstract class BaseVOMapper<T> where T:BaseVO
{
public abstract void Insert(BaseVO child , BaseVO parent );
public abstract void SaveChildrens(List<T> childListToPersist, BaseVO parentVO);
}
Below is the implementation o f the derived class , where FlightList is a List<FlightVO> & FlightVO: BaseVO & as per polymorphism ,I assume , I can pass List<FlightVO> where List<BaseVO> is expected.However , I endup getting the below error.
Argument '1': cannot convert from 'System.Collections.Generic.List<ValueObjects.FlightVO>' to 'System.Collections.Generic.List<ValueObjects.BaseVO>'
i.e
public class FlightVO : BaseVO
{
public int FlightId;
public string FlightName;
}
public class ScheduleVOMapper: BaseVOMapper<BaseVO>
{
public override void Insert(ValueObjects.BaseVO child, ValueObjects.BaseVO parent)
{
//((ScheduleVO)child).FlightList
this.SaveChildrens(((ScheduleVO)child).FlightList, parent);
}
public override void SaveChildrens(List<BaseVO> childListToPersist, BaseVO parentVO)
{
foreach (BaseVO child in childListToPersist)
{
ORlayerEngine.Persist(child, parentVO);
}
}
}
------------------------------------------------------------------Code using Generic at Method Level ------------------------------------------------------------------------------------------
Case 2
// generic type specified at method level , with the same constraint
public abstract class BaseVOMapper
{
public abstract void Insert(BaseVO child , BaseVO parent );
public abstract void SaveChildrens<T>(List<T> childListToPersist, BaseVO parentVO) where T:BaseVO ;
}
Below is the implementation of the derived class :
public class ScheduleVOMapper: BaseVOMapper
{
public override void Insert(ValueObjects.BaseVO child, ValueObjects.BaseVO parent)
{
//((ScheduleVO)child).FlightList
this.SaveChildrens(((ScheduleVO)child).FlightList, parent);
}
public override void SaveChildrens<T>(List<T> childListToPersist, BaseVO parentVO)
{
foreach (BaseVO child in childListToPersist)
{
ORlayerEngine.Persist(child, parentVO);
}
}
}
Comparing Case 1 & Case 2 , in case 1 , in the derived class ScheduleVOMapper , the SaveChildrens method has the generic type explicity specified as BaseVO ,
whereas in Case 2 , the method gets the Generic Type at runtime , which anyways as per the constraint has to be of Type BaseVO.
Though , I have my solution implemneted using Case 2 , would really like to get my doubt's cleared
Many Thanks
Girija
|
|
|
|
|
Why do you declare
girijaa wrote: public class ScheduleVOMapper: BaseVOMapper<basevo>
and not FlightVO instead of BaseVO as generic parameter?
I couldn't test it right now, just guessing.
Urs
-^-^-^-^-^-^-^-
no risk no funk
|
|
|
|
|