in

ASP.NET Weblogs

Natty Gur

.Net from enterprise architect point of view.

February 2004 - Posts

  • Need your opinion about writing "Building a System-of-Systems infrastructure in .NET environment" book

    I've got unexplained enthusiasm to write a book about Building a System-of-Systems infrastructure in .NET environment.

    I wrote the linked manuscript that includes suggested (but not finished) table of contents and couple of pages that walk through the main topics of that book.

    I'll be grateful to here if you find that book "Marketable" or NOT.

     

     

  • IL, Metadata tables and Generics.

    .Net assemblies contain IL code that your compiler generate from your favorite language and metadata, in form of related tables, that contain all needed data about assembly types and references assemblies. Whidbey introduce generics that enable us to create parametric types (refer to Juval Lowy article). Those types that declare generic parameters enable the class creator to declare constraints on generic parameters. As written in every article on that subject generics embedded deep into CLR thus there must be any modifications to IL and Metadata to reflect generics.

     

    There are two new metadata tables that describe generics GenericParam (or 2a and GenericParamConstraint or 2c).  :

     

    // =================================================
    // 42(0x2a): GenericParam         cRecs:    2(0x2), cbRec: 12(0xc), cbTable:    24(0x18)
    //   col  0:  Number       oCol: 0, cbCol:2, USHORT 
    //   col  1:  Flags        oCol: 2, cbCol:2, USHORT 
    //   col  2:* Owner        oCol: 4, cbCol:2, TypeOrMethodDef
    //   col  3:  Name         oCol: 6, cbCol:2, string 
    //   col  4:  Kind         oCol: 8, cbCol:2, TypeDefOrRef
    //   col  5:  DeprecatedConstraint oCol: a, cbCol:2, TypeDefOrRef
    // -------------------------------------------------
    //    1 == 0:0000, 1:0000, 2:TypeOrMethodDef[02000002], 3:string#47, 4:TypeDefOrRef[02000000], 5:TypeDefOrRef[02000000]
    //    2 == 0:0000, 1:0000, 2:TypeOrMethodDef[06000003], 3:string#89, 4:TypeDefOrRef[02000000], 5:TypeDefOrRef[02000000]
    // =================================================
    // 44(0x2c): GenericParamConstraint cRecs:    2(0x2), cbRec:  4(0x4), cbTable:     8(0x8)
    //   col  0:* Owner        oCol: 0, cbCol:2, GenericParam
    //   col  1:  Constraint   oCol: 2, cbCol:2, TypeDefOrRef
    // -------------------------------------------------
    //    1 == 0:GenericParam[2a000001], 1:TypeDefOrRef[01000001]
    //    2 == 0:GenericParam[2a000002], 1:TypeDefOrRef[01000003]
    // 

     

    GenericParam    Holds all the generics parameters, both of class and method. Column 2 set the owner of the parameter. In our example the first parameter second column point to table 0x2 that holds type definitions thus it’s a Type parameter. The second parameter points to table 0x6 which holds methods definitions thus its Method generic parameter. Column 3 holds generic parameter Name that you set (T). Column 4 set the parameter type which always point to the first entry of type definition table that preserve for Object. DeprecatedConstraint, I can’t figure it up but this column also always points to Objects. (By the way I saw that Mono consider to remove the fourth and fifth parameters)

     

    GenericParamConstraint holds constraints, if exist, for Generic parameters. It’s petty simple and small table that contains two columns. The fist column points to entry in GenericParam table containing the constraint parameter. The second column point to entry in TypeRef table that hold definitions of the constraint type.

     

    IL uses !x to refer Generic Type parameters where x stand for the position of generic parameter when declared. !!x represent methods generic parameter where x stand for the position of generic parameter when declared. Angle brackets (<>) represent the type chosen for generic parameter when using generic class / method.

     

    When you declare generic type and set it generic parameter to certain type the metadata contains the type signature and uses it to display Intellisense and impose type safe. You can see signatures by dumping unresolved externals.

     

    // -------------------------------------------------------
    //             CallCnvntn: [LOCALSIG]
    //             5 Arguments
    //                     Argument #1:  GenericInst Class ClassLibrary1.MyCol< I4>
    //                     Argument #2:  GenericInst Class ClassLibrary1.MyCol< String>
    // 
    // Signature #2 (0x11000002)
    // -------------------------------------------------------
    //             CallCnvntn: [FIELD]
    //             Field type:  GenericInst Class ClassLibrary1.MyCol< I4>
    // 
    // Signature #3 (0x11000003)
    // -------------------------------------------------------
    //             CallCnvntn: [FIELD]
    //             Field type:  GenericInst Class ClassLibrary1.MyCol< String>
    // 

     

  • "The process cannot access the file because it is being used by another process"

    As you probably know there are several causes to that message. One of them is due to the fact that .NET cache in memory files that are larger then 64K, thus those files always being used by another process. One simple way to workaround this behavior is to change project build configuration from debug to release, to build the project and then switch back to debug configuration.

    oops, thanks to Mordy Shachar!

  • Using tracing intensively may cause high CPU.

    It might sound banal but I actually help a guy few days ago. I got a phone call that ASP.NET application that he develop consuming 50% of CPU with minimum server pressure and climb to 100% CPU when request start to come rapidly.

    That guy develop simple ASP.NET application, no multi-threading or other complexly just Select/Insert/Update application. So it looks very strange to me that CPU goes so high.

    Well the reason was that he use Tracing as logger to write down what is going on in his application without being aware that ASP.NET write is own stuff into trace data. When he stop tracing, CPU just return to normal values. We end up by using Nspring to write a-synchronous into a log file, ending up with better RPS.

  • Generics on Wednesday (2/18) C# user group.

    If you live in Israel, you could come and see my session about Generics on tomorrow c# user group.

    "Our next session is about Generics. We will touch upon Generics both in the conceptual and the practicable levels. We will start by discussing the need for generics and demonstrate how Generics handles the lower levels of the CLR (IL, Metadata). Then we will see how to use generics and its abilities by building a Front controller for ASP.NET and Avalon Windows Navigation applications. "

  • COM+ and .Net practical approach

    This article is actually made up from three main parts. The first part handles all the aspect of using COM+. After reading this part you will know what the options that you have to host your assembly in COM+, impact on ASP.NET application performance of any option and what are, if any, limitations impose by selecting certain COM+ hosting option.

    The second part describes all the administrative benefits that your application can gain from COM+. This part includes details about improving availability and stability using COM+ and who to monitor and use monitor data to detect quickly and easily problems sources.

    The third part describes daily programming tasks that can be archive easily by using COM+ features. COM+ include many features that can reduce the number of code lines and time that you might invest in order to fulfill common programming tasks. This part outlines those programming tasks and explains demonstrates how to use COM+ to achieve them.

    http://weblogs.asp.net/ngur/articles/70434.aspx

     

    Any comments ?

  • Turning caspol -s off and Oracle ODP stops to retrieve data. - Oracle Response

    Oracle support successfully re-create that problem in their Lab. they confirm is a problem (not bug, yet) but there isn't any solution, workaround right now.

  • ASP.NET 2.0 and utility classes.

     I'm working these days with ASP.NET 2.0 (actually 1.2) for several reasons. As I already posted ASP.NET 2.0 don’t come with building option inside VS.NET. ASP.NET compiles ASPX files and code behind files while application called from the first time. So if you add utility class to the project no one will compile your utility class and you can't use it. Even if you use Page Inherits attribute to set Page base class to class inside your project, the page won't recognize your base class at runtime. The only way I found out to add classes is by creating class libraries and references them from ASP.NET project. By the way the current version doesn't support project reference from ASP.NET projects.

     

    I hope I'm missing something, although I can't see what… And if I don’t miss something I hope MS will add ability to add classes into ASP.NET application. One might say that this attitude better since ASP.NET just handles pages and all other classes that hold logic and data must be outside ASP.NET project. But still there are cases that you want classes inside ASP.NET.

  • ASP.NET generates Personalization code even if you didn’t ask for it in your page.

    While writing an article about the way Whidbey handled ASPX files I notice that ASP.NET generate personalization assembly and several personalization functions inside ASPX assembly. ASP.NET generate this code although I didn’t ask anywhere on the page for Personalization. Well, it turned out that HttpPersonalization Tag in Machine.config is responsible for generation of Personalization code. HttpPersonalization has enable attribute that set by default to true and cause generation of code. If you want to turn code generation of personalization off set enable attribute to false.

  • Turning caspol -s off and Oracle ODP stops to retrieve data.

    One of my clients, which got close network, use caspol -s off to turn down client side stations security. After w while ODP code that run perfectly on developers machine stop to work, while MS oracle driver works perfectly. ODP code throws exceptions such as “Invalid Operation” or others that really didn’t tell you anything. As you probably figure out it took us a lot of time to find that turning off caspol causes ODP to misbehave, but we humans, don’t we? 

     

    Now the ball is in the hands of Oracle guys …. I’ll keep you posted.

     

     

More Posts Next page »