|
Sorry, I meant to add that bit in but forgot
This part is tricky for me to word so please accept my apologies before hand.
JITting occurs when one of a few things happen: A method is being run for the first time, the underlying IL of an already JITted method has changed, or in certain circumstances the native code produced by ngen will be ignored (ASP.NET is one case). There are also some Debug/Profiling methods that will perfrom a re-JIT.
Unless you are causing the JIT by running ngen, the native code generated will be tossed out after the Assembly has been unloaded. The native code generated is also AppDomain specific, so if you have two AppDomains each loading the same assembly then each method will be JITted once for each AppDomain.
Now in your case, the JIT will only occur the first time each method is used, regardless of whether the object using that method is created by Reflection or regular code.
James
- out of order -
|
|
|
|
|
I have a strange problem with a custom control (derives from System.Windows.Control). I've added code to the protected OnKeyDown and OnKeyUp methods of my control to handle up/down/left/right keypresses.
The keys work great most of the time. The one case where they do not work is when my control is used with the System.Windows.Forms.ListBox control. The listbox kills the focus on my control, preventing any keypress events from fireing. Sometimes the listbox takes the focus itself, sometimes not.
Any ideas on what the deal is? Thanks.
|
|
|
|
|
Jon Rista wrote:
The one case where they do not work is when my control is used with the System.Windows.Forms.ListBox control.
What exactly is the relationship between your custom control and the listbox? Is on embedded within the other, are you superclassing, are they siblings on a form...?
|
|
|
|
|
They are siblings on a form.
After more testing, this seems to be a .NET issue. By default, .NET seems to shift focus when the arrow keys are pressed down. Focus is automatically taken from one control and moved to the next until it hits a control that can keep the focus. For example, if you put a button, a checkbox, a textbox, and a radio button on a form, in top-down order, you can try this:
Click the button. Press down arrow three times. You will see the focus shift from the button, to the checkbox, and stop at the textbox, never reaching the radio button. Somehow the textbox is keeping the focus, although how I do not know.
I need to figure out what .NET does that prevents a custom control derived from the Control class from keeping focus once it has it. Well, rather, keeping focus when the arrow keys are pressed, it keeps focus for all other key events.
|
|
|
|
|
is there any facility available in VISUAL STUDIO .NET editor
to get the class diagram of a given project
|
|
|
|
|
No, you'd have to use Visio 2002 as well in order to get the class modeling features you want.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
I've been playing around with the graphics object's transform functions (scale,rotate,translate). While they are useful functions for doing static drawing, they seem to be inefficient when used in a more dynamic drawing environment.
For example, when I need to move images across the surface of a large, background image, and I use ScaleTransform to properly scale all the various components being drawn, the drawing is much more sluggish than when I simple handle the scaling the old-fashioned way (pre-calculate the values and draw all the bitmaps to a scaled rectangle as when BitBlting or strechtblt ).
I am placing the ScaleTransform in my paint function. I see no way to use the Transform functions in the same way that the old Win32/gdi MapMode functions were used (set them once and they are applied on every paint).
Is there something I am missing about how to use the Transforms, or am I just expecting more from them than was intended?
"Any clod can have the facts, but having opinions is an art."
Charles McCabe, San Francisco Chronicle
|
|
|
|
|
Hi,
I don't know if this is the correct forum, but let's try...
I have some componente written in VB.Net that is called by ASP pages.
All of them works fine except for one that gives me the "class doesn't support automation" error message. The only help that I've got was "try to contact the application vendor"...
Running it interactively, I have another error message that I'm trying to work around ("The root transaction wanted to commit, but transaction aborted"), but this is a ContextUtil problem.
All the components have the same imports and inherits clauses and same properties in the packages. Any clue?
Thanks in advance,
Molina.
|
|
|
|
|
If you do, what do you end up with?
I assume that you end up with nothing, and the GC eventualy will take care of anything that gets created in the constructor up until the exception gets thrown.
Am I mistakin'?
Paul Watson wrote:
"At the end of the day it is what you produce that counts, not how many doctorates you have on the wall."
Unknown wrote:
"Don't sweat the petty things, and don't pet the sweaty things."
|
|
|
|
|
I have to keep fighting the urge to assume everthing's like C++, but that seems to be right.
I tried creating an object as described, caught the exception in the function where the object was created, and nothing was returned. That is, since the constructor never finishes, a pointer to the object (ahem, I mean a reference to the "reference type") never gets assigned. I would imagine the object actually gets created on the gc heap before the constructor is called, or else nothing could be assigned in the ctor, but that only the gc knows about it if the ctor fails (interrupted by an exception).
The destructor (finalize method in framework paralance) does eventually get called, when the gc gets around to it. I forced it by calling GC.Collect(), and all was fine.
Cheers
|
|
|
|
|
That's basically right.
The one exception to watch for is if any non-managed memory gets allocated as part of your constructor sequence, you need to put cleanup code in a handler for that case.
Generally you'll know if you're doing this directly, but if you create any objects that implement IDisposable, you should try to call their Dispose method. For example, Windows Forms Controls allocate a window handle. Its better to call Dispose on them before they become unreachable rather than wait for the GC to do it.
Burt Harris
|
|
|
|
|
I'm trying to expose my custom WMI class:
/////////////////////////////////////////////////////
[assembly:Instrumented("Root/Default")]
[System.ComponentModel.RunInstaller(true)]
public class MyInstaller : DefaultManagementProjectInstaller {}
[InstrumentationClass(InstrumentationType.Instance)]
public class InstanceClass : Instance
{
public string SampleName;
public int SampleNumber;
public void DoSomething()
{
//Doing something...
}
}
....
InstanceClass instClass = new InstanceClass();
instClass.SampleName = "Hello";
instClass.SampleNumber = 111;
instClass.Published = true;
/////////////////////////////////////////////////////
But when I try to invoke DoSomething method:
/////////////////////////////////////////////////////
ManagementObjectSearcher s = new ManagementObjectSearcher(new ManagementScope("Root/Default"),new SelectQuery("InstanceClass"));
foreach (ManagementObject ob in s.Get())
{
ob.InvokeMethod("DoSomething",null);
}
/////////////////////////////////////////////////////
I get System.Management.ManagementException stating that this method is not implemented
at System.Management.ManagementException.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementObject.GetMethodParameters(String methodName, ManagementBaseObject& inParameters, IWbemClassObjectFreeThreaded& inParametersClass, IWbemClassObjectFreeThreaded& outParametersClass)
at System.Management.ManagementObject.InvokeMethod(String methodName, Object[] args)
at WMIClient.Form1.button1_Click(Object sender, EventArgs e) in e:\_projects_\dotnet_projects\_tests_\wmiclient\form1.cs:line 126
However, I can successfully set and get values of data members:
/////////////////////////////////////////////////////
lb1.Items.Add((string)ob.GetPropertyValue("SampleName"));
/////////////////////////////////////////////////////
Do I need some additional actions to be taken before I call InvokeMethod, or maybe
I have something wrong with the method definition?
Is it possible at all to expose methods in WMI custom classes?
Best regards,
Eugene
|
|
|
|
|
I have a process where I am taking a schema, running a transform against it, and saving the resulting xml file. Today we do this manually with XMLSpy without problems. I would like to change this to be a programmatic function.
When I build my transform wihtin the framework, however, it requires me to feed it only an XML file. If I feed it an XSD file, it runs it through an XML validator and kicks out the file.
Is there a way of running a transform on a schema? Is there some way of turning off the xml validator? (and if so, how?)
Thanks for any input!!!
_____________________________________________
The world is a dangerous place. Not because of those that do evil, but because of those who look on and do nothing.
|
|
|
|
|
Is it possible to impersonate the caller of a method that is remoted? I have a remote component (which currently I'm planning to always run on the same machine as the client) that is hosted by a Windows Service. I want to run the service as LocalSystem yet impersonate the client user for some sections of code. Is this possible? Does it require COM+ and does that affect remoting?
|
|
|
|
|
I create a little graph using World Transformation for drawing lines and it works perfectly. But when It comes to draw a string, by DrawString() method, the string is distortedly displayed. The position is right but the size and scale of the font is also affected by the transformation. Is there anyway to fix this?
Ruxo Zheng
|
|
|
|
|
I'm trying to re-implement a project that I have previously written in C++ using ATL.
Basically, I want to implement a COM object using C# which is hosted inside a Windows Service. I have the COM object and the Window Service both implemented in the same C# project. I cant figure out how in .NET to specify that all instances of the object should be created remotely in the single Window service. I've seen how this can be done using Remoting however I'm wondering if they is any other alternative that will work from non .NET clients? Using ATL there was a way to register the COM class objects so that a single server process was used as the host. Is this effect possible with .NET?
|
|
|
|
|
I'm writing a Windows application using C#, targeted to run on Win9x/ME clients which log on through a NT domain server. I want to get the identity of the user and his/her roles to check authorization. I use System.Security.Principal.WindowsIdentity.GetCurrent() to get current identity and it works very well on Win2K/NT/XP but not on 9x/ME... I've searched in .NET document about this problem but found nothing about this.
So is there any trick to make WindowsIdentity works on Win9x? or do I have to use Win32 API to get username (I recall the function "GetUserNameEx" for user name but how to get its group or authentication status)?
Thanks
Ruxo Zheng
|
|
|
|
|
The reason it doesn't work is because 9x was never built with true networking and network security in mind. Thus you really don't have a true WindowsIdentity.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
Microsoft has reinvented the wheel, this time they made it round.
-Peterchen on VS.NET
|
|
|
|
|
Thanks David.
Now I wonder how can IIS get a WindowIdentity from Windows 9x that running IE? Can I mimic the same behavior in our code (perhaps, by Win32 API)?
Ruxo Zheng
|
|
|
|
|
Hello All,
I am currently modeling a GIS geometry primitives like point, line, polyline, polygon etc.
Initially, I named everything according to the OpenGIS.org recommendations just to realize that .NET has the same name for Point and Rectangle.
My co-workers on Java project had no problem because in the Java2D, the names are Point2D, Rectangle2D etc.
GIS points are generally 3D but most applications are 2D.
What will you do?
(Please, I know about namespaces and I am using them, we just do not want to confuse the user of our products - it is a component not a standalone application so will be used by programmers.)
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Namespaces are an integral part of the .NET framework, or any good OOP language. Go ahead and use your own namespace. If programmers using .NET or Java, they should be used to qualifying (if they need to) your component objects by now.
|
|
|
|
|
Hi.
I HATE REGULAR EXPRESSIONS!
Oh, thats better.
Could someone do be a big favour and write a regular expression that will match to these examples. I'm doing a bit of URL Rewriting and its just causing me pain!
/resultsdownload_n_37.Zip
/resultsdownload_ma_3712.Zip
/resultsdownload_all_2337.Zip
/resultsdownload_out_121243.Zip
/resultsdownload_bottom_2321.Zip
/resultsdownload_fudgecake_1.Zip
Thanks guys. The Regex object is doing my head in!
E.g.
Why doesn't
/resultsdownload_net_37.Zip
match to
/resultsdownload_[a-z+]_37.Zip
???
Thanks again.
Pete
Pete
Insert Sig. Here!
|
|
|
|
|
Ah. Sorted it.
It seems my + was in the wrong place. It needs to be outside the [] not inside.
Heres the final result if anyone is interested
/resultsdownload_[a-z]+_[0-9]+\.zip
Pete
Insert Sig. Here!
|
|
|
|
|
i have a windows application which i previously written in others
computer using his microsoft visual studio .NET.
now, i had oledi made the change on the source code and want to
re-compile it using Microsoft .NET Framework SDK. this is becuase my
computer dun have license on microsoft visual studio .NET.
i was wondering how can i build my project which i previous done in
MSVS .NET by using Framework SDK command line? or is there any where
to generate a MAKE file in MSVS .NET and then build the entire project
using Framework SDK command line with the help of MAKE file?
thank you.
regards
yccheok
|
|
|
|
|
Check out NAnt[^], it has a program (called SLiNgshot, if I remember correctly) which will parse solution/project files and either product .build files to use with NAnt or build the solution/project.
Many people on the DOTNET lists have recommended its use for any real projects using .NET. Apparently the build system in VS.NET isn't very viable when working with large projects (there are several known bugs that occur when building dlls/exes that are larger than 64K).
Once you know how to compile the smaller bits and pieces using the commandline using NAnt is a breeze. Here's a tip, .resx files first get compiled by resgen before being listed as a resource by the C# compiler (cs.exe).
James
- out of order -
|
|
|
|