Welcome to MSDN Blogs Sign in | Join | Help

February 2004 - Posts

How to get the assembly version and file version of your own assembly?

The question is, when your assembly is executing, how do you figure out the assembly version and file version of your own assembly? Your assembly (while executing) can be returned from System.Reflection.Assembly.GetExecutingAssembly(). So: Assembly Version:
Posted by junfeng | 10 Comments
Filed under:

Assembly listing Tool

So my submission in gotdotnet.com sample finally gets approved. Here is the link to download it. http://www.gotdotnet.com/Community/Resources/Default.aspx?AFXPath=/Resource[@ResourceId='F0CECD72-7287-4891-8D5E-5763AD14C2FD'] ] This is a tool to show the
Posted by junfeng | 2 Comments
Filed under:

Console unicode output

Eric Lippert discussed how Windows Script Host output unicode in console for NT based OSes here . Of course, every console based applications have the same problem. This includes gacutil. In 1.0 and 1.1, gacutil translate everything to ANSI, then use
Posted by junfeng | 4 Comments
Filed under:

CLR Profiler, Office 2003, WPS Office 2003, and Open Office 1.1

So I was playing CLR Profiler lately. It comes with a very good document written in word. It is really a simple document with text, and a lot snapshots. The document is about 11M. When I finished reading the document, I noticed my machine kind of slows
Posted by junfeng | 2 Comments
Filed under:

jusched.exe

I really hate applications doing thing on my back. That is why I rename %ProgramFiles%\Common Files\Real\Update_OB\realsched.exe to realsched.exe.bak. And I just find out something called jusched.exe is running on my back. tlist shows it is from Sun's
Posted by junfeng | 38 Comments
Filed under:

Moving from Win32 to .Net

One of the biggest difference in Win32 and .Net is probing. In Win32 (and *nix), OS loader looks for binaries in directories specified in %PATH% environment variable. In .Net, we probes GAC, and app base. That is it. We do not honor %PATH% environment
Posted by junfeng | 2 Comments
Filed under:

Performance: One big assembly vs several small assemblies.

I frequently see people ask the same question in microsoft.public.dotnet.framework.clr and microsoft.public.dotnet.framework.performance. Which one has better performance, one big assembly or several small assemblies? Strictly from a performance point
Posted by junfeng | 9 Comments
Filed under:

Chris Brumme discusses Finalization

We had a rather heated internal disccusion about managed code reliability, and one of discussion is finalizer. Chris Brumme wrote a very long reply revealed the details of finalization and why it is not reliable. The great thing is, he posted it in his
Posted by junfeng | 0 Comments
Filed under:

Cost of calling unmanaged code from managed C++

Question and answers about cost of calling unmanaged code from managed C++. From: Subject: RE: Cost of calling unmanaged code from managed C++ The biggest difference in performance is the cost of parameter marshalling. With C++ because you can work with
Posted by junfeng | 5 Comments
Filed under:

Alan discussed Unification Policy

Alan discussed unification policy at his latest blog . As usual he puts a lot of though in his blog. Great read.
Posted by junfeng | 0 Comments
Filed under:

new MSN Explorer

Did you use the new MSN explorer? It is definitely one of the most beautiful softwares I have ever used.
Posted by junfeng | 15 Comments
Filed under:

How "safe" (from a best practice and supportability perspective) is the use of DLL injection techniques?

Another question in internal discussion. Here is one reply: From: Subject: RE: DLL Injection DLL injection is never safe. You're talking about squirting code into a process that was never designed, built, or tested by the process's author, and co-opting
Posted by junfeng | 4 Comments
Filed under:

Why recursive directory copy does not exist, and why it should not.

This question comes up in internal discussion from time to time. The reason is, the semantics of directory copy is not well defined. It largely depends on what you need. Here are some questions you need to answer before you go implement one: 1. Do you
Posted by junfeng | 17 Comments
Filed under:

Microsoft Virtual Server 2004 begins beta test

I don't work in VirtualPC team but I use their product almost everyday and I love it. So I think I should run some advertisement for them;) news coverage can be found here http://news.com.com/2100-1012_3-5161193.html?tag=nefd_top .
Posted by junfeng | 5 Comments
Filed under:

Fun stuff with \\?\

This comes up in an internal discussion about MAX_PATH limit. People do mention that the core file services supports syntax like \\?\ for path longer than MAX_PATH. The caveat is that file name with \\?\ is not canonicalized by the OS. This can lead to
Posted by junfeng | 4 Comments
Filed under:

How is lock keyword of C# implemented?

This question is asked in an internal discussion. And here is the answer from CLR team. From: Subject: RE: How is lock keyword of C# implemented? At the core, it’s typically one „lock cmpxchg“ instruction (for x86) for entry, and one
Posted by junfeng | 5 Comments
Filed under:

File Not Found vs Network Path not found

So the other day I received an email from a colleague. He had an assembly load failure. And the fusion binding log looks like following: *** Assembly Binder Log Entry (2/10/2004 @ 5:41:08 PM) *** The operation failed. Bind result: hr = 0x80070035. The
Posted by junfeng | 1 Comments
Filed under:

Windows XP and ClearType

I have LCD at home, and I turn on ClearType from Control Panel->Display->Appearance->Effects. But I never know I can tune the ClearType setting. Visit this page http://www.microsoft.com/typography/ClearTypeInfo.mspx to tune your ClearType settings
Posted by junfeng | 1 Comments
Filed under:

Fusion binding log and fuslogvw.exe

Suzanne blogs again! This time, she is helping you on diagnose MissingMethodException . Of course, whatever she tries to help you, she can't live without fusion log. So what exactly is fusion log? Remember what fusion's role is in assembly binding? Fusion
Posted by junfeng | 12 Comments
Filed under:

FileVersion and GAC

Every assembly has an identity, which includes name, version, culture, and public key/token. Also every binary in Windows can have a file version. The file version is orthogonal to assembly version, and there is no co-relation at all. You can change them
Posted by junfeng | 5 Comments
Filed under:

foo.exe and foo.dll

So that I got a complain today about foo.exe and foo.dll. The whole story is like this: The tester produces two binaries foo.exe and foo.dll, with the same identity (name, version, culture, public key token). And the tester uses gacutil to install both
Posted by junfeng | 0 Comments
Filed under:

AppDomainSetup explained

AppDomainSetup is a properties bag. It stores various properties that affects binding decision in an appdomain, as well as other decision as well. MSDN documents each properties in AppDomainSetup. But there are a few properties that are not well explained
Posted by junfeng | 2 Comments
Filed under:

Return to fusion land

After much deviation, finally I returned to fusion land. Hope you enjoy it.
Posted by junfeng | 0 Comments
Filed under:

AppDomain and Shadow Copy

.Net Framework has a feature called Shadow Copy . When shadow copy is enabled on an appdomain, assemblies loaded in that appdomain will be copied to a shadow copy cache directory, and will be used from there. This is great because the original file is
Posted by junfeng | 15 Comments
Filed under:

WritePrivateProfileString and AnitVirus

Another shocking discovery. WritePrivateProfileString hangs because AntiVirus is accessing the ini file. I really don't know what to do now.
Posted by junfeng | 2 Comments
Filed under:

vim and Windows Server 2003

I am a vim user. If you use vim under Windows Server 2003, you may find this useful. vim6.2 has a bug in Windows Server 2003. It does not save the console buffer correctly. When vim exists, the console buffer is empty. Fix is available from http://cream.sourceforge.net/vim.html
Posted by junfeng | 1 Comments
Filed under:

How to make an application as both GUI and Console application?

This is another common asked question. But it is a Win32 question. In Windows GUI applications and Console applications are very different. GUI applications have at least one window, and a message loop, but no standard in/out/error. Console applications
Posted by junfeng | 12 Comments
Filed under:

How to tell if an assembly is delay signed or not.

.Net framework has a great feature called delay signing. Every strongly named assembly has a public key, and a strong name hash stored in the metadata. At runtime CLR uses the public key to verify the strong name hash to make sure the assembly is not
Posted by junfeng | 1 Comments
Filed under:

New categories

I guess my category management is really horrible. Most of my posts are listed in others. Others is supposed to be non-important stuff! Hope the new categories makes more sense.
Posted by junfeng | 0 Comments
Filed under:

Longest Java Class Name

http://www.davidflanagan.com/blog/000017.html I wonder if someone has time to the same analysis on .Net framework. I bet it will be much longer:)
Posted by junfeng | 6 Comments
Filed under:

How to tell if some file is managed assembly or not?

Another commonly asked question. There are many ways to detect if a given file is a managed assembly or not. For example, in VS.Net 2002/2003, dumpbin has an option /clrheader. It will dump the CLR header for you if the file is a managed assembly. You
Posted by junfeng | 5 Comments
Filed under:

GetPrivateProfileString/WritePrivateProfileString

Learned a hard lesson. Contention between GetPrivateProfileString and WritePrivateProfileString may cause a deadlock, even for multiple processes. If you intent to Read/Write the same ini file, you have to lock the file yourself. Yes, I know they are
Posted by junfeng | 10 Comments
Filed under:

How to detect .Net Framework installed in a web client?

In my last post I talked about how to detect .Net framework installed in your local machine. This is another .Net framework detection. But not for you, it is for web servers. Suppose you browse some web site. How does that web site know if you have installed
Posted by junfeng | 3 Comments
Filed under:

How to detect .Net framework installed or not.

This is another frequently asked question. If you search google how to detect .Net Framework , this( http://support.microsoft.com/default.aspx?scid=kb;%5BLN%5D;315291 ) page ranks very high. Ignore all the details in the KB articles. It basically asks
Posted by junfeng | 13 Comments
Filed under:

Very long assembly name

Speaking of file name inspired me to write another post about assembly name. Windows supports long file path since Win95 time. It has a MAX_PATH limit, which is defined as 260. Prior to .Net era, you seldom see long file name. If you poke around your
Posted by junfeng | 9 Comments
Filed under:

User friendly file name

There was an interesting discussion not long ago. People complain file names are just too user un-unfriendly. What is WISPTIS.exe? It is “Microsoft Tablet PC Platform Component”. How could you tell from its name? Valid complain. Other people
Posted by junfeng | 4 Comments
Filed under:

Where is .Net framework installed?

This is another often-asked question. As of today, there is no managed answer. mscoree!GetCORSystemDirectory returns the directory of where .Net framework is installed. It is documented here ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/grfungetcorsystemdirectory.asp
Posted by junfeng | 2 Comments
Filed under:

How to get thread id for a managed thread?

This question comes up from time to time. The answer is, there is no explicit numeric thread id for managed thread today in .Net framework. Now if you do need a numeric thread id for whatever reason, you can use System.Threading.Thread.GetHashCode().
Posted by junfeng | 10 Comments
Filed under:

How to create circularly referenced assemblies

In .Net framework System.dll and System.Xml.dll reference each other. How is it possible? Circularly referenced assemblies are chicken-and-egg problem. The trick is how to break the dependency chain. Here is one way I find working. Step 1. Create assembly
Posted by junfeng | 7 Comments
Filed under:
 
Page view tracker