LogoLogo
WinForms to WebPowerBuilder to .NETPowerBuilder to Java
  • WebMAP Documentation | Mobilize.Net
  • WinForms
    • Introduction
    • Getting Started
    • Conversion Process
    • Post-Conversion
    • Extend or Modify the Converted Application
      • NoWebMap Forms Winforms
        • How to add a new Form
        • Adding the created form to the migrated App
        • Interacting with the application data
        • Call the custom API
        • Interaction between the no webmap added Form and the WebMap components
      • Adding a component
      • Adding a component dynamically
      • Add a new control model
      • Switching CSS theme
      • Adding new window
      • Conversion Configuration
        • WebMAP configuration file
        • Stub Filter
      • Adding Non-WebMap Angular Forms
      • Adding FrontEnd Handler to a ToolStripMenuItem
      • Changing ToolStripButton icons
      • Adding new items to existing toolbar
      • Adding FrontEnd element properties and JS listeners
      • Adding FrontEnd output handlers
      • Access FrontEnd components
      • Create custom components based on existing WebMap Component
      • Override FrontEnd methods
    • Assessment Mode
    • Errors and Troubleshooting
      • How to resolve broken reference problems with VBUC
    • Portability
    • Glossary
    • Release Notes
    • Internal Demos
    • Known Issues
    • WinForms DCP
  • WebForms
    • Introduction
    • Overview
    • Desktop Compatibility Platform (DCP)
      • Pages and Master Pages
      • GridView and DataList data synchronization
      • HTTP objects
    • Post-Conversion
    • Extend or Modify the Converted Application
      • Adding FrontEnd validator
      • Adding Page
      • Adding MasterPage
    • Designer classes on WebForms Conversion Tool
    • Errors and Troubleshooting
      • How fix Solution when have been added website from filesystem without project file
    • Release Notes
  • PowerBuilder to .Net
    • Introduction
    • Getting Started
      • Conversion Tool
    • Desktop Compatibility Platform (DCP)
      • Data Manager
    • Reports
      • Report Rendering in Modernized Code
      • ReportWatcher Service Configuration
      • Data Manager to RDL Conversion
      • Reporting Service Internals
      • Troubleshooting
  • PowerBuilder to Java
    • Introduction
    • Getting started
    • Post-Conversion
      • Setup PBJava Environment
      • Architecture
      • App Start
    • Glossary
    • Errors
    • Glossary
    • FAQ
      • How to create a new Control
      • How to create a new Screen
      • What is the Mobilize.WebMAP.CoreServices.All?
      • What is the DesignerAttribute?
      • What is the InterceptedAttribute?
      • What is the InterceptedAttribute?
      • What is the ObservableAttribute?
      • What is the Mobilize.Weaving.WebMAPExtensions.All?
  • General
    • FrontEnd
      • Documentation
        • Webforms Angular Components
          • Web Components
            • Base Components
              • BaseValidator Component
            • KendoUI Components
              • CompareValidator
              • CustomValidator
              • RegularExpressionValidator
              • RequiredFieldValidator
              • ValidationSummary
          • Directives
          • AJAX Web Components
            • AjaxCalendar
            • AjaxModalPopupExtender
          • Ajax Interaction Services
        • Client Core
          • WebMap's Client Core
        • Angular Client
          • Introduction
          • WebMap Service
          • WebMap Interceptor Service
        • Base Components
          • Introduction
          • Components
            • Container
            • Control
            • ControlContainer
            • FormsContainer
            • Loading
            • Stub
        • Winforms Angular Components
          • Web Components
            • Base Components
              • Control Component
              • Form Container
              • Grid Component
              • Style
            • KendoUI Components
              • AdoDataControl
              • Button
              • C1TrueDBGrid
              • CheckBox
              • CheckedListBox
              • ComboBox
              • ContextMenuStrip
              • DataGridView
              • DataGridViewFlex
              • DateTimePicker
              • FileDialog
              • GroupBox
              • Label
              • ListBox
              • ListView
              • MaskedTextBox
              • MessageBox
              • NumericUpDown
              • Panel
              • PictureBox
              • PrintDialog
              • ProgressBar
              • RadioButton
              • RichTextBox
              • StatusStrip
              • Stup
              • TabControl
              • TabPage
              • TextBox
              • Timer
              • ToolStrip
              • TreeView
              • WebBrowser
              • Window
            • JQuery Web Components
          • WebMap FrontEnd Architecture
          • Migrated Structure
          • Setup
            • Front-End setup and compilation
            • Components Manual
            • Browser Support
            • Unit Test Manual
            • Development Process
            • Setup AOT/JIT Compilation
          • Decorators
            • Server Event
          • Conventions
            • Application Structure and NgModules
            • Coding
            • Components
            • Data Service
            • Directives
            • Lifecycle hooks
            • Names
            • Services
        • PowerBuilder Kendo Components
          • Base Components
            • base-component
            • column-control
            • controlcontainer
          • Data Manager Componets
            • base-data-manager
            • data-manager-control
            • data-manager-control-base
            • dw-checkbox
            • dw-column
            • dw-complexNumericMaskComponent
            • dw-compute
            • dw-date-time-edit-mask
            • dw-dropdowndatawindow
            • dw-edit
            • dw-edit-mask
            • dw-radio-button
            • dw-simple-numeric-edit-mask
            • dw-string-edit-mask
            • dw-time-edit-mask
          • Window Components
            • basemask
            • graphics
            • w-checkbox
            • w-command-button
            • w-complex-numeric-mask
            • w-date-time-edit-mask
            • w-dropdownlistbox
            • w-group-box
            • w-line
            • w-listbox
            • w-maskedtextbox
            • w-mdiclient
            • w-menu
            • w-multiline
            • w-picture
            • w-picture
            • w-radiobutton
            • w-rectangle
            • w-simple-numeric-edit-mask
            • w-single-line-edit
            • w-statictext
            • w-string-edit-mask
            • w-time-edit-mask
            • w-toolbar
            • w-toolbaritem
            • w-user-object
            • w-window
          • Services
            • DmInteractionService
          • DataManagerEvents
          • FocusManager guide
      • Api Documentation
        • WebMap Silverlight
        • WfNetC1Components
        • WebFormsComponents
      • Guides
        • Setup NPM package registry in the workspace
        • How to Setup WebMap Applications To Run Over SubDomains or WebApplications In IIS
        • Deploy several WebMap Apps in the same Server
        • Update to Angular 16
        • Appearance
          • How to change the CSS
          • How to override the style for a component
        • Component maintenance
          • How link WebMap package to the migrated Application
          • How to resolve broken reference problems with VBUC
          • How to test a local WebMap Components package
          • How to add a new component in a migrated application
          • How to update a component
          • Dynamic Control Support
          • How to add new set of component with a different provider
          • How to test your component in the playground
          • Tools
        • WMLogger
          • How to use the WMLogger's instance
          • How to change log's level
          • How to add log tags
        • Integration test
        • Setup WebMap Applications to Run Front-End And Back-End In Separates Sites
          • Setup WebMap Applications To Run Front-End And Back-End In Separates Sites in Production (IIS)
        • Setup Migrated WebMap Applications To Run Front-end & Back-end In Separates Sites (Only development)
        • Initial Set Up
          • Software to Install
          • Necessary Repositories
      • Errors
      • Version Notes
        • Client Core
        • Angular Client
        • Web Base Components
        • Winforms Angular Components
        • PowerBuilder Kendo Components
      • Licenses
        • Client Core
        • Angular Client
        • Base Components
        • PB Kendo Components
        • WFNet Kendo Components
        • WebForms Components
        • WFNet Access Components
        • WFNet Janus Components
        • WFNet C1 Components
        • Silverlight wms-framework
        • Silverlight i-components
    • BackEnd
      • WebMAP From Scratch
      • Setup
      • DCP: Desktop Compatibly Platform
        • Overview
        • Library Bundles
          • Bundle Library
            • Create an Observable Object
          • Bundle DTO
            • DTO: Data Transfer Objects
              • Creating a DTO
            • Mappers
              • Create Mappers
            • Observable Wrappers
              • Create an Observable Wrapper
            • API/Controllers
      • Architecture
      • Weaving on WebMAP
      • Glossary
      • FAQ
        • How to create a new Control
        • How to create a new Screen
        • What is the Mobilize.WebMAP.CoreServices.All?
        • What is the DesignerAttribute?
        • What is the InterceptedAttribute?
        • What is the Mobilize.Extensions.Logging.RollingFile?
        • What is the ObservableAttribute?
        • What is the Mobilize.Weaving.WebMAPExtensions.All?
      • Licenses
        • PBNet DCP
        • WebFormsDCP
        • WFNet DCP
        • CoreServices
        • CoreServicesCommon
    • Request and Response
  • SCALABILITY
    • Introduction
    • Microservices
    • Containerizing a WebMap .Net Application with Docker
    • Vertical scalability
Powered by GitBook
On this page
  • What happens when a map is not found for a type?
  • Configure the Stub Filter File

Was this helpful?

  1. WinForms
  2. Extend or Modify the Converted Application
  3. Conversion Configuration

Stub Filter

PreviousWebMAP configuration fileNextAdding Non-WebMap Angular Forms

Last updated 2 years ago

Was this helpful?

WebMAP uses a mechanism called maps in order to be able to convert a given type from the original application into another one. This mechanism is in charge of matching and replacing a type that is provided via configuration. The mapping process is handled by a .map file which is used to define one by one what a specific type is transformed to.

When a map for a given type is found as part of the configuration file it is automatically applied by the conversion tool, changing each occurrence of said type into the new type defined in the file.

The image below shows the way in which a System.Windows.Forms.Button is transformed into a different type.

What happens when a map is not found for a type?

When a type is not found as part of any .map file then the original type is replaced by another mechanism called Stub Generator. This mechanism is in charge of creating a new type based on the uses found for the original type, which is used to replace the original type. A new class with an almost identical signature is generated to replace the uses of the type, the main difference is that

The Stub Generation is needed because in many cases there is a need to remove the dependencies from the original framework even though there is not a map responsible of making the change. For example is not common, recommended nor desired to keep a Windows Forms reference in a Web project. They are also used to reduce or remove the amount of compilation errors of changing a type to another that does not exist.

What if a type should not be replaced by a Stub?

The Stub Generation mechanism replaces any not map type by default, however, it has a customization (Stub Filter) option that can be used to add exceptions to the stub rules, so, the original type remains the same in the converted application.

This is a customization file that allows excluding certain assemblies, classes and namespaces from the mapping process.

The reason behind this configuration is to enable the conversion process to be control over what is being mapped, if there's a namespace that is not required to be converted, or a third party library that does not need a transformation. This file can be modified to specify which namespaces, classes or assemblies need to be filtered out.

To actually allow the stub filter customization the following tags can be added to the Stub Filter XML file to generate the desired outcome for the conversion.

Assemblies, classes and namespaces are the main filters that can be applied to be excluded from the mapping process, this might be desired be done for a variety of reasons, the main one is to exclude a reference to a library that doesn't require transformation because it will work the same way in both the original and the converted applications.

In order to create a new filter option the following tags must be used:

Exclude an Assembly

The assembly tag will filter all the contents of a given assembly, while the class and namespace are more specific, the namespace tag will filter all the classes under the namespace, not taking into account embedded namespaces.

Assemblies cannot be included as regular expressions filters. Such as System.Runtime.*, which are used to transform expressions in regular expression patterns that can be defined by an user.

To create an assembly exclusion use the following format:

  • Create an Assembly tag into the Filter tag

  • Add a Name attribute including the assembly that needs to be excluded from the Stub Generation process

<Filter>
    <!--Filters all types found in this assembly-->
    <Assembly Name="System.Runtime.InteropServices"/>
</Filter>

Exclude a Namespace

The namespace tag for will filter all the contents of a given namespace, while the class is more specific, the namespace tag will filter all the classes under the namespace, not taking into account its origin assembly.

Namespaces cannot be included as regular expressions filters.

To create an assembly exclusion use the following format:

  • Create an Namespace tag into the Filter tag

  • Add a Name attribute including the namespace that needs to be excluded from the Stub Generation process

<Filter>
    <!--Filters all types that match this specific namespace-->
    <Namespace Name="System.ComponentModel"/>
</Filter>

Exclude a Class

The class tag will filter all the contents of a given class, the class tag will filter only the specified class, not taking into account its namespace nor its assembly.

To create an assembly exclusion use the following format:

  • Create a Class tag into the Filter tag

  • Add a Name attribute including the fully qualified class name that needs to be excluded from the Stub Generation process

<Filter>
    <!--Filters this specific class occurences-->
    <Class Name="System.Drawing.Point"/>
</Filter>

Additional Parameters

AssemblyReferencedIn

The Assembly tag can also have some additional attributes such as the AssemblyReferencedIn attribute, which indicates that an assembly reference will not be added to the converted projects when it is defined with a specified Framework. The attribute value should be a list of .NET Target Frameworks for example (net461 or netcoreapp3.1) separated by comma.

To remove the inclusion of a reference to a specific .NET version use the following format:

  • Create a AssemblyReferencedIn attribute whithin the Assembly tag including the name of the desired .NET frameworks

<Filter>
    <!--Filters all types found in this assembly-->
    <!--and exclude this the reference for the specified .NET versions-->
    <Assembly Name="System.Runtime.InteropServices" AssemblyReferencedIn="net461,netcoreapp3.1"/>
</Filter>

ForceInclude

The Force include tag works the opposite way of the AssemblyReferencedIn attribute, instead of filtering a class so is not transformed an exception to an already establish filter can be generated. There are two ways to specify the inclusion, a specific class name for a given namespace, or using simple regex asterisk to specified all the classes inside the namespace.

To force the inclusion of a specific namespace use the following:

  • Add a ForceInclude tag within the Filter tag

  • Include a Namespace attribute with the desired namespace name

  • Include a Class attribute with the desired class name

<Filter>
    <ForceInclude Namespace="System.ComponentModel" Class="IContainer"/>
</Filter>
  • Alternatively, the class attribute's value may be replaced with an asterisk (*) to include all classed within the specified namespace

<Filter>
    <ForceInclude Namespace="System.Media" Class="*"/>
</Filter>

AssemblyException

The AssemblyException tag is used to ignore any library that does not require conversion, and stay the same in the converted solution, it is used only for Assessment mode purposes and it does not have any impact in the converted solution's code.

To force the inclusion of a specific namespace use the following:

  • Add an AssemblyException tag within the Filter tag

  • Include a Name attribute with the desired namespace name, it may include regular expressions (*).

<Filter>
    <AssemblyException Name="System.Xml.*"/>
</Filter>

Configure the Stub Filter File

A sample of a stub filter file can be found below.

To correctly load a stub filter file, it must be added within the additional-parameters section of the .

WebMAP cofiguration file
3KB
NetStubFilter.xml
Stub Filter sample file
Image 1. A type is converted by the map mechanism.
Image2. I type is converted by the stub mechanism.
Image 3. A type converted using the stub filtering option.