RSS 2.0 Feed
2004-07 Entries
摘要:如果你注重你的.Net程序的性能的话,你绝对应该读读这本书. http://msdn.microsoft.com/netframework/archive/default.aspx?pull=/library/en-us/dnpag/html/scalenet.asp  ...[阅读全文]

posted @ | Feedback (7) | Filed Under [ .Net ]

摘要:我在我的英文blog上发表了一篇关于MultiModule assemblies的文章 http://blogs.msdn.com/junfeng/archive/2004/07/15/183813.aspx. 比较有意义的是,在VC++ 2005里, link.exe可以把多个netmodule连接成一个assembly.这个东东很多人已经期待很久了....[阅读全文]

posted @ | Feedback (0) | Filed Under [ .Net ]

摘要:新浪上转载IT经理世界的文章<< 联想别慌 >>, 很值得一读. http://tech.sina.com.cn/it/2004-07-21/0935390870.shtml 新浪是我看国内IT的主要媒体.如果大家有什么好的网站可以推荐. 总的感觉是,国内的IT还是硬件远大于软件.很少见到新浪上有关于国内软件公司的长篇报道....[阅读全文]

posted @ | Feedback (5) | Filed Under [ Other ]

摘要:不知道有多少人注意VC++ 2005。在我们这里,有很多人对VC++ 2005很兴奋。有些人认为,VC++ 2005会把很大一部分程序员从C#阵营转到VC里:) Stephen Toub的这篇文章是一个很好的总结。Write Faster Code with the Modern Language Features of Visual C++ 2005http://msdn.microsoft.com/msdnmag/issues/04/05/visualc2005/default.aspx 以Hello, World结尾吧。 C:\HelloWorld>more hello.cppint main(){    System::Console::WriteLine("Hello, World!");    return 0;} C:\HelloWorld>cl hello.cpp /clrureMicrosoft (R) C/C++ Optimizing Compiler Version 14.00.40607.16for Microsoft (R) .NET Framework version 2.00.40607.16Copyright Microsoft Corporation.  All rights reserved. hello.cppMicrosoft (R) Incremental Linker Version 8.00.40607.16Copyright Microsoft Corporation.  All rights reserved. /out:hello.exe/clrimagetypeurehello.obj C:\HelloWorld>helloHello, World!...[阅读全文]

posted @ | Feedback (45) | Filed Under [ .Net ]

摘要:Use the following app.config to enable server GC. <configuration>  <runtime>    <gcServer enabled="true" />  </runtime></configuration> Use System.Environment.IsServerGC to check if server GC is turned on or not....[阅读全文]

posted @ | Feedback (6) | Filed Under [ .Net ]

摘要:Gotdotnet.com 上发表的break changes from version 1.1 to 2.0 上有一条:   Cache load failures in order to ensure that different app domains do not have different dependency loading success/failure characteristics in domain neutral sharing scenarios   http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx#00000067   link里有说明这是怎么回事。简单的说,在同一个AppDomain里,如果 Assembly.Load/Assembly.LoadFrom()第一次失败了的话,以后同一个Assembly.Load()/Assembly.LoadFrom()会继续失败,并且会返回同一个exception,即使你在第一次和第二次之间把assembly拷到正确的地方。   举个例子。假设a.dll在c:\temp\a.dll。 现在当前AppDomain的AppBase是c:\myapp.   Assembly.Load(“A, version=0.0.0.0, culture=neutral, publickeytoken=0123456789abcde”  // will fail with FileNotFoundException since a.dll is not in c:\myapp; File.Copy(“c:\\temp\\a.dll”, “c:\\myapp\a.dll” Assembly.Load(“A, version=0.0.0.0, culture=neutral, publickeytoken=0123456789abcde”  // this will succeed in 1.0/1.1, but will fail in 2.0, since in 2.0 the binding failure of the first bind is cached.   这个改变的原因是让assembly binding in one AppDomain有个一致的行为。第一次成功了,以后就会成功。第一次失败了,以后就会失败。   当然最根本的原因是为了共享。没有这个保证的话共享是不可能的。...[阅读全文]

posted @ | Feedback (1) | Filed Under [ .Net ]

摘要:My MSN Messenger is zhangjf AT hotmail DOT com. Replace AT with '@' and DOT with '.' of course. Sorry I have to post it this way to avoid spam. I got way too many spam in my hotmail and I am pananoid. You are welcome to add me to your buddy list. And you are welcome to discuss .Net technology with me in MSN Messenger. But please don't spam me with things I don't know. I reserve the right to not answer any questions. Remember, my specialty is CLR loader and fusion. ...[阅读全文]

posted @ | Feedback (1) | Filed Under [ General ]

摘要:记住,这只是preview而已,出了问题不要找我 .NET Framework 1.0 Service Pack 3 Tech Preview: http://www.microsoft.com/downloads/details.aspx?FamilyId=CF52CA95-F2CC-459F-87EE-C17D16E22F08&displaylang=en .NET Framework 1.1 Service Pack 1 Tech Preview: http://www.microsoft.com/downloads/details.aspx?FamilyId=12721880-CB9F-4481-9610-987 .NET Framework 1.1 Service Pack 1 Tech Preview for Windows Server 2003: http://www.microsoft.com/downloads/details.aspx?FamilyId=DA1C20AD-35AE-4CEA-8451-730FCD603383&displaylang=en Newsgroup support: http://communities.microsoft.com/newsgroups/default.asp?icp=techpreview&slcid=us...[阅读全文]

posted @ | Feedback (7) | Filed Under [ .Net ]

摘要:我觉得最好的办法来说明这个feature是通过例子: using System.Runtime.InteropServices;using System; public class TestClass{    public static void Main(String[] args)    {        IntPtr user32 = LoadLibrary("user32.dll");        IntPtr procaddr = GetProcAddress(user32, "MessageBoxW");        MyMessageBox mbx = (MyMessageBox)Marshal.GetDelegateForFunctionPointer(procaddr, typeof(MyMessageBox));        mbx(IntPtr.Zero, "Hello, World", "A Test Run", 0);        // MessageBox(IntPtr.Zero. "Hello, World", "A Test Run", 0);    }     internal delegate int MyMessageBox(IntPtr hwnd, [MarshalAs(UnmanagedType.LPWStr)]String text, [MarshalAs(UnmanagedType.LPWStr)]String Caption, int type); /*        [DllImport("user32.dll")]    internal static extern int MessageBox(IntPtr hwnd, String text, String Caption, int type);*/     [DllImport("kernel32.dll")]    internal static extern IntPtr LoadLibrary(String dllname);     [DllImport("kernel32.dll")]    internal static extern IntPtr GetProcAddress(IntPtr hModule, String procname);} GetDelegateForFunctionPointer的文档在http://lab.msdn.microsoft.com/library/en-us/cpref/html/M_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointer_2_52ec9e31.asp...[阅读全文]

posted @ | Feedback (5) | Filed Under [ .Net ]

摘要:这个是纯粹CLR loader的东西。和Fusion没有任何关系。所以我没有把Fusion放在标题上。   如果你有一个Assembly。你想让你知道的另一个Assembly看到前面那个Assembly的Type,可是你不想让其他别人看到它们。怎么办?   答案是Friend Assemblies (http://lab.msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_csref/html/df0c70ea-2c2a-4bdc-9526-df951ad2d055.asp)  ...[阅读全文]

posted @ | Feedback (14) | Filed Under [ .Net ]

摘要:本来想写一点关于这个的东东.发现Jazon Zander已经写了.我就不现丑了. Jason Zander是CLR的Product Unit Manager. http://weblogs.asp.net/jasonz/archive/2004/05/31/145105.aspx...[阅读全文]

posted @ | Feedback (0) | Filed Under [ .Net ]

摘要:AppDomain类有了一个新的API AppDomain.ApplyPolicy (http://lab.msdn.microsoft.com/library/en-us/cpref/html/M_System_AppDomain_ApplyPolicy_1_62522ff1.asp) 顾名思义,这个API干的事情就是给一个Assembly Name, applies binding policy,然后返回post policy的Assembly Name。 现在,你可以不用Assembly.Load而回答这个问题了: 我有一个Assembly Name,到底Assembly.Load()会给我什么结果呢?...[阅读全文]

posted @ | Feedback (1) | Filed Under [ .Net ]

摘要: 严格上说这个是CLR loader的一个新冬冬。但我就厚颜无耻的借用了:)   System.Reflection.Assembly 类里加入了一些新的Method和Property。以下几个是这里讨论的:   Property Assembly.ReflectionOnly (http://lab.msdn.microsoft.com/library/en-us/cpref/html/P_System_Reflection_Assembly_ReflectionOnly.asp) Method Assembly.ReflectionOnlyLoad(Byte[]) (http://lab.msdn.microsoft.com/library/en-us/cpref/html/M_System_Reflection_Assembly_ReflectionOnlyLoad_1_0d447871.asp) Assembly.ReflectionOnlyLoad(String) (http://lab.msdn.microsoft.com/library/en-us/cpref/html/M_System_Reflection_Assembly_ReflectionOnlyLoad_1_62522ff1.asp) Assembly.ReflectionOnlyLoadFrom(String) (http://lab.msdn.microsoft.com/library/en-us/cpref/html/M_System_Reflection_Assembly_ReflectionOnlyLoadFrom_1_62522ff1.asp)   从它们的名字就可以猜到,通过这些API装载的Assembly只能做Reflection。你可以读到它里面所有的Type,但你不能激活任何一个。对ReflectionOnly*返回的Type, CreateInstance会throw exception.   这些API有几个目的: 1.实现跨ProcessorArchitecture的introspection。比如说64位的Assembly是不能在32位的.Net framework上装载的。如果你有一个64位的Assembly,在32位的.Net framework上你就一点办法就没有了。而这些API可以让你看到里面的Type。这就让第二种情况成为可能。 2.Crosss ProcessorArchitecture Compilation。就是说用32位的Managed Tools去编译64位的Assembly。现在TlbExp/TlbImp用这些API来实现对64位managed assembly的操作。 3.Assembly.Load*很多时候会运行一些指令。在有些情况下你只想看Assembly中的Type,不想运行任何程序。这种时候你就可以使用这些新API。 4.另一个很重要的一点是现在Assembly.Load*都Apply Policy了。结果就是你拿到的和你想看的Assembly可能完全不一样。而Assembly.ReflectionOnlyLoad* 100%返回你指定的Assembly。这个对Compiler和Tool来说是很重要的。   它们的用法是在MSDN上有文档。下面是一些说明和限制:   ·          Duplicates: It's okay to load a copy of an assembly into the inspection context and another into the creating appdomain, for execution.  They will result in different Assembly instances. ·          Execution APIs: APIs which would execute something will throw an InvalidOperationException when given an inspection-only type.  For example, CreateInstance(Type) should throw when passed a type from an inspection-only assembly. ·            ·          Caching: All inspection assemblies will......[阅读全文]

posted @ | Feedback (2) | Filed Under [ .Net ]

摘要:在v1里,我们有Assembly.Load(string), Assembly.Load(Byte[]), Assembly.Load(AssemblyName), Assembly.LoadFrom()。在v1.1里新加了Assembly.LoadFile(string).  在这些API里,Assembly.Load(string)和Assembly.Load(AssemblyName)会apply binding redirect policy。  但其他的不会。 在v2.0里,所有这些API都Apply policy。 背后的原因是,希望实现single point servicing。只要安装一个publisher policy,所有的程序都能看到这个改变。以前的时候Assembly.LoadFile/Assembly.Load(Byte[])/Assembly.LoadFrom()是看不到这个publisher policy的。所以安全补丁不能被它们用到。 这个也算是Trustworthy computing的一部分吧。    ...[阅读全文]

posted @ | Feedback (0) | Filed Under [ .Net ]

摘要:Gotdotnet.com 发布了2.0的breaking change http://www.gotdotnet.com/team/changeinfo/Backwards1.1to2.0/default.aspx 有机会我会讨论和fusion/CLR loader有关的....[阅读全文]

posted @ | Feedback (4) | Filed Under [ .Net ]