|
Thanks a lot Martin. Its working fine now.
|
|
|
|
|
Hi folks,
How the windows API differenciate Normal EXE'x from the .Net EXE's, for example when you click the .Net exe file then it should be load the CLR into memory and execute the exe otherwise it never load CLR to execute. If any one knows please share with me.
Advance Thanks,
friendly,
ranandbe
|
|
|
|
|
ranandbe wrote: How the windows API differenciate Normal EXE'x from the .Net EXE's, for example when you click the .Net exe file then it should be load the CLR into memory and execute the exe otherwise it never load CLR to execute. If any one knows please share with me.
A .NET executable contains a special CLR Header, which is only available in .NET executables. The PE (portable executable) header will redirect the OS to this section. It's worthwhile getting to know how the PE format is used and what it does.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thank You. After you say that i go and open the EXE with ILDASM utility.
It Shows the following at the program entry point.
.method private hidebysig static void Main() cil managed
{
.entrypoint
.custom instance void [mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00 00 )
// Code size 26 (0x1a)
.maxstack 8
IL_0000: nop
IL_0001: call void [System.Windows.Forms]System.Windows.Forms.Application::EnableVisualStyles()
IL_0006: nop
IL_0007: ldc.i4.0
IL_0008: call void [System.Windows.Forms]
******************************
} // end of method Program::Main
What it tells?
friendly,
ranandbe
|
|
|
|
|
That is is a windows forms application. However, this is not the PE header that was discussed before. This is the .NET entry point. The OS must be aware this is a .NET executable assembly already by this point.
|
|
|
|
|
Hello,
I'm looking for a winform component that behave like the visual studio Watch.
Did anyone saw such a component ?
Thanks.
|
|
|
|
|
Have you resolved this?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
I need to write an application that will fetch some data using WebService & insert it in to a database. This application will be put into a Windows Task Scheduler & will be run on a weekly basis. So should I go for Console Application or Windows Service application?
Kindly let me know the advantage & dis advantage of both the above apps.
Regards,
Vipul Mehta
|
|
|
|
|
If you plan on running it through Task Scheduler it must be a user mode application (either Console app or WinForms). A windows service is something that starts (generally) automatically when the operating sytems starts and runs even when no users are logged in. They generally don't have any UI components as well.
The issue you will have with a Task Scheduled service is that the users will be able to change the schedule and even remove it. A windows service is somewhat protected from that, but the user could still stop or disable the service.
|
|
|
|
|
Hi,
Not every body will have right to install or probably update the schedules for that service.
Yes I want some message to be shown when service starts OR there is some issue OR completes successfully.
Regards,
Vipul Mehta
|
|
|
|
|
I would choose a console application, since you must perform some operations and done, right? Most windows services are listening at a particular tcp port, in where requests are attended. Most of times they're ment to run forever perfoming operations under the system account. So, if you choose this way, you will have to take care of schedlule by your own -Windows Task Scheduler applies to regular executable programms or batch files onlyI would choose a console application, since you must perform some operations and done, right? Most windows services are listening at a particular tcp port, in where requests are attended. Most of time they're meant to run forever performing operations under the system account. So, if you choose this way, you will have to take care of Schedule by your own -Windows Task Scheduler applies to regular executable programs or batch files only, although you can write a batch to start a service and another to stop it...
Hope this helps
|
|
|
|
|
Yes... my Windows Console Application/Windows Service will run once a week (through Windows Task scheduler)
Will the Windows Service keep on executing or we can run it as per the Task Scheduler?
Regards,
Vipul Mehta
|
|
|
|
|
Services never run out of the Task Scheduler. Services run from the time Windows starts until it's shutdown.
Task Scheduler runs user mode process, like Console or Windows Apps.
|
|
|
|
|
Thanx Very Much
Regards,
Vipul Mehta
Sr. Software Engineer
Accenture Services Pvt Ltd
|
|
|
|
|
I have a console application, which is a WSE2 Web service with several soap methods. The application starts and the memory usage increases constantly until it reaches to approximately 700MB, then it won't respond anymore. This memory leak happens on Windows 2K3 with SP2 Framework 1.1, but i can't reproduce it in Windows 2K SP4, weird isn't it
I've reviewed the code in each method to release resources and call Dispose if needed. I have also checked some counters with perfmon and clr_profiler, but no clue of what is causing this behavior. Please help me
|
|
|
|
|
hi guys i am creating an application in which i am creating a dll at runtime.
i have defined one parameterized construcor,every thing goes ok.,
when i am going to save this dll on the disk , it says, "classname" my type is not completed
why
?
thanks in advance
hello
|
|
|
|
|
This is a problem that occurs when developing with .Net Framework 2.0 (coding and debugging in VC++ 2005 Express and VC# 2005 Express):
1. Create a normal Windows SDK Console application that loads a DLL using LoadModule() and calls a function (lets call it "load") on the loaded dll.
Lets call the application "App".
2. Create the dll to be loaded: A C++ .Net class library which implements the given "load" function. "load" loads a pure .Net assembly (eg written in C#), takes a static method from it and calls it. It also needs to provide a sample ref class with a method, named ClassA and MethodA.
Lets call this library "PluginA".
3. Create a .Net Class Library in Visual C#, add PluginA to the reference list and implement the static method which will be called by PluginA. In the method it should use ClassA and call MethodA on it.
Lets call the C# lib "PluginB".
4. Ensure that all 3 projects are in different folder. Eg.:
App in App,
PluginA in App/Plugin
PluginB in App/Plugin/DotNet
What happens:
App loads PluginA
PluginA loads PluginB
PluginA and PluginB are now in the same AppDomain and PluginA's Assembly-object contains the desired type ClassA (I checked).
The Problem:
PluginB will still try to load the referenced PluginA again and fail when trying to access ClassA if PluginA is not in PluginB's working directory.
If PluginA is in PluginB's working-directory, PluginB will load PluginA again and AppDomain.CurrentDomain.GetAssemblies() will contain PluginA's Assembly Object twice.
Conclusion?
If 2 Assemblies are in the same AppDomain, they should both be able to use each other's types without having to reload them - Why is this not the case?
This seems to be a bug and MS doesn't seem to have a bugtracker...
-- edit:
It doesn't matter if PluginA uses Assembly.Load(byte[]), Assembly.LoadFrom(string) or Assembly.LoadFile(string), if PluginA is signed or not doesn't seem to play a role either.
PluginB's MethodA of ClassA (C++/CLI) contains:
array^ asms = AppDomain::CurrentDomain->GetAssemblies();
Console::WriteLine("Current assemblies:");
for (int i = 0; i < asms->Length; i++) {
Assembly^ as = asms[i];
Console::WriteLine(as->GetName());
}
When called by PluginB, the output is the following:
Current assemblies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginA, Version=1.0.2837.29213, Culture=neutral, PublicKeyToken=a740aaa0a688231e
msvcm80d, Version=8.0.50608.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyToken=a740aaa0a688231e
Where the second PluginA Assembly object has been loaded by PluginB, after I copied PluginA again to the working directory. If I do not copy PluginA, PluginB (when PluginA uses Assembly.Load(byte[]) for loading) will throw the following exception (Standard windows Console output, thus badly formatted - sorry):
##########################################################################
Failed loading assembly: System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocation. ---> System.IO.FileNotFoundExcep
tion: Could not load file or assembly 'PluginA, Version=1.0.2837.29052, Culture=
neutral, PublicKeyToken=a740aaa0a688231e' or one of its dependencies.
File name: 'PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyToken=a74
0aaa0a688231e'
at PluginB.Class1..ctor()
=== Pre-bind state information ===
LOG: User = DOMINIK\Domi
LOG: DisplayName = PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyTo
ken=a740aaa0a688231e
(Fully-specified)
LOG: Appbase = file:///d:/Projects/C++/test/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=
null.
===
LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2
.0.50727\config\machine.config.
LOG: Post-policy reference: PluginA, Version=1.0.2837.29052, Culture=neutral, Pu
blicKeyToken=a740aaa0a688231e
LOG: Attempting download of new URL [...]
I also posted this behavior at: Microsoft forums
|
|
|
|
|
Doomii wrote: This seems to be a bug and MS doesn't seem to have a bugtracker
http://connect.microsoft.com/[^]
Doomii wrote: It doesn't matter if PluginA uses Assembly.Load(byte[]), Assembly.LoadFrom(string) or Assembly.LoadFile(string), if PluginA is signed or not doesn't seem to play a role either.
If you use 'Assembly.LoadFrom(string assemblyLocation)' then that method should try and resolve all the references of the assembly it's loading. From what I've seen when playing with my own plugin stuff it'll only try and load any assemblies not already loaded. These assemblies of course have to be the same version otherwise they are treated as 2 seperate assemblies.
Doomii wrote: Current assemblies:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginA, Version=1.0.2837.29213, Culture=neutral, PublicKeyToken=a740aaa0a688231e
msvcm80d, Version=8.0.50608.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
PluginA, Version=1.0.2837.29052, Culture=neutral, PublicKeyToken=a740aaa0a688231e
You can see in your output that 'PluginA, Version=1.0.2837.29213' and 'PluginA, Version=1.0.2837.29052' have different versions.
|
|
|
|
|
originSH wrote: You can see in your output that 'PluginA, Version=1.0.2837.29213' and 'PluginA, Version=1.0.2837.29052' have different versions.
Thats just because i didn't update the copied PluginA in the working directory. It doesn't matter, even if I use an updated version, the problem is still the same, see here:
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e
msvcm80d, Version=8.0.50608.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
PluginB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e
originSH wrote: If you use 'Assembly.LoadFrom(string assemblyLocation)' then that method should try and resolve all the references of the assembly it's loading.
It should, but it sadly doesn't. I get the same problem if I compile PluginB with the updated version of PluginA (which I always do) and use LoadFrom instead (the output above is generated when using LoadFrom). If I don't copy "PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e" to the working directory, it will say:
Could not load file or assembly 'PluginA, Version=1.0.2837.29477, Culture=neutral, PublicKeyToken=a740aaa0a688231e' or one of its dependencies.
Which clearly is already loaded.
|
|
|
|
|
You can try hooking into the assemblyresolve event on the AppDomain:
"AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);"
that will allow you to resolve the assembly yourself if .Net fails, that will atleast let you then do the load manually from the already loaded assemblies.
|
|
|
|
|
This is great! Now it finally works!
Although, similar to the solution posted on the MS boards (use the GAC, which I prefer not to (although I know I am recommended to)), the reason for why the bug actually existed is unclear.
|
|
|
|
|
|
I am using VS2005 with Windows XP and I want to programmatically access "Display Properties - Settings - Extend My Windows Desktop Onto This Monitor" by pressing a checkbox. Can you please tell me where I can access this property from my code, Thanks Brennan
|
|
|
|
|
Have you resolved this?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
hi all,
Can some one tell me the new features of .net framework 2.0 at the architecture level,
i.e the changes in compilation,gc compared to compilation ,gc in 1.1 version.
I need the changes at the architecture level
would be happy if someone give reply.
|
|
|
|
|