Framework WebForms

for DotNet environment

The way Julia handles this framework should reduce FieldAccess and CloseResource warnings related to graphical components of web pages, together with Deadcode warnings on event handlers (both of page events and of ui events).

Required libraries: System.Web.dll

Applicability

This specification gets automatically applied when:

  • the framework of the analysis contains the word dotnet (case insensitive)
  • a class whose name is equals to System.Web.HttpApplication is supertype of at least one application's class
  • a class whose name starts with System.Web.UI is supertype of at least one application's class


Implications between annotations

Some annotations of this framework get translated automatically into standard Julia annotations, such that the analysis engine can react accordingly. Namely:

  • if an element is annotated with Microsoft.Build.Framework.RunInMTAAttribute, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with Microsoft.Build.Framework.RunInSTAAttribute, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with System.MTAThreadAttribute, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint
  • if an element is annotated with System.STAThreadAttribute, Julia considers it to be annotated also with:
    • com.juliasoft.julia.extraction.EntryPoint


Predicates

Predicates are named conditions that can be used inside other conditions. This framework defines the following predicates:

  • predicate isAutoWiredApplicationMethod is defined as follows:
      (that is defined in a class that is subtype of a class whose name is equal to System.Web.HttpApplication and whose name starts with Application_)
  • predicate isAutoWiredPageMethod is defined as follows:
      (that is defined in a class satisfies predicate isControlClass and whose name starts with Page_)
  • predicate isControlClass is defined as follows:
      that is subtype of a class whose name is equal to System.Web.UI.Control
  • predicate isEventHandler is defined as follows:
      ((whose return type is equal to void and (that has a number of parameters is equal to 2 and (that has a parameter (whose index is equal to 0 and that has a type whose name is equal to System.Object) and that has a parameter (whose index is equal to 1 and that has a type that is subtype of a class whose name is equal to System.EventArgs)))) and that is defined in a class satisfies predicate isControlClass)
  • predicate isPageComponent is defined as follows:
      (has a type satisfies predicate isControlClass and is defined in a class satisfies predicate isControlClass)
  • predicate isResourceGetterInsideControl is defined as follows:
      (that is defined in a class satisfies predicate isControlClass and (that has a return type that is subtype of a class whose name is equal to System.IDisposable and whose name starts with get_))


Specifications on application code

These are conditions that, if satisfied on a given program component, will cause the specified annotations to be placed on such component. These will annotate only program components coming from the application under analysis, and not the libraries. This framework defines the following specifications:

  • annotate any method that satisfies the following:
      satisfies predicate isResourceGetterInsideControl
    with:
    • com.juliasoft.julia.checkers.closeWhereCreated.ResourceThatDoesNotNeedToBeClosed
  • annotate any method that satisfies the following:
      (satisfies predicate isEventHandler or (satisfies predicate isAutoWiredApplicationMethod or satisfies predicate isAutoWiredPageMethod))
    with:
    • com.juliasoft.julia.extraction.EntryPoint
  • annotate any field that satisfies the following:
      satisfies predicate isPageComponent
    with:
    • com.juliasoft.julia.extraction.ExternallyRead
    • com.juliasoft.julia.extraction.Injected


Specifications on library code

These express the signature of program components that will be annotated with the specified annotations. These will annotate program components coming both from the application under analysis and the libraries. This framework defines the following library specifications:

  • annotate class System.Web.UI.Control with:
    • com.juliasoft.julia.checkers.closeWhereCreated.ResourceThatDoesNotNeedToBeClosed