.NET+ protocol

The VuGen .NET+ (DotNetPlus) protocol is used to create scripts that emulate users of Microsoft .NET client applications created in .NET 6 or .NET 8.

Tip:  

  • For .NET Framework, use the .NET protocol. For details, see .NET protocol.

  • If necessary, you can use the .NET+ protocol with .NET 7, or other versions that are not officially supported by VuGen. For details, see Manually create a .NET+ script.

.NET+ protocol overview

.NET+ Vuser scripts are coded manually in C#. There is no recording option.

The .NET+ protocol enables you to load test by replaying the application’s method calls.

Note:

Although .NET-based and Java protocols support creating threads, we recommend that you do not use background threads in real load testing scenarios because:

  • Threads can degrade tests scalability.

  • Threads can affect performance measurements.

  • The utility functions' behavior is undetermined if called from any thread except the Vuser main thread which runs the vuser_init, Action, and vuser_end actions. This applies to all functions named lr*.

Back to top

Manually create a .NET+ script

You can manually code .NET+ scripts in the VuGen editor, or from Visual Studio.

For information on creating and coding scripts, see Code a .NET script.

For information on editing in Visual Studio, see Create and view Vuser Scripts in Visual Studio.

Note: The following restrictions currently apply for .NET+ scripts:

  • There are no Visual Studio add-ins or templates.

  • Breakpoints and step-by-step mode are not supported.

To manually create and edit a .NET+ script:

  1. Prerequisites:

    • Download and install the Microsoft .NET SDK. During replay, the installed .NET SDK is identified using internal logic.

    • If you are using Visual Studio, make sure a supported version is installed. For details, see the Supported Protocols.

  2. In VuGen, in the Create a New Script dialog box, open a new .NET+ script.

  3. Open the Runtime Settings window and define the regular settings for your script.

    In addition, define how .NET+ works at runtime in the .NET pages:

    Page Content
    Dotnet Settings
    • SDK selection. The installed .NET SDK is identified using internal logic. If you want to use an alternative .NET SDK, specify the path to the SDK executable.

    • Additional build params. Provide the path to any additional build parameters you want dotnet.exe to use.

    • Use supported .NET version. By default, the .NET+ protocol works with .NET 6. To use .NET 8, select 8 from the dropdown list. .NET 6 and .NET 8 are the versions officially supported by VuGen.

    • Use alternative .NET version.This option should be used only when you cannot work with .NET 6 or .NET 8. Using a .NET version that is not officially supported by VuGen may produce unexpected results.

      Select the checkbox, and in the field enter the major version number only, without build numbers. For example, for .NET 7.0.7 enter: 7.

    Package References Add the names of NuGet packages that contain the referenced assemblies.
    Local References Add locally-referenced assemblies required by the script.
    Shared Libraries

    Add paths to shared libraries for referenced assemblies. These assemblies are not copied to the script folder.

    For details, see Adding and sharing .NET assemblies.

    Note:  

    • You can add COM reference dependencies from Visual Studio only, not from VuGen Runtime Settings.

    • Script replay is supported on 32 and 64-bit. For 64-bit, in Runtime Settings > Miscellaneous, select Replay script with 64-bit.

  4. Insert your code into the script. .NET+ supports all the .NET functions. For details, see the Function Reference (select the relevant version).

    Tip: To open and edit the script in Visual Studio, click the button on the toolbar.

    You can include methods returning a dataset, data table, or data reader action, and VuGen generates a grid for displaying the data. For details, see View data sets and grids.

Back to top

Adding and sharing .NET assemblies

You can manually add references to DLL assemblies to your .NET scripts, using the Local References page in the runtime settings. The referenced DLL assemblies are, by default, copied to the script folder for use at runtime. However, these local copies of the DLL increase the script size, and can cause high memory use on the load generators.

Instead of including these DLLs in each script folder, you can create shared DLL libraries. When you add a shared library, at runtime the load generator accesses the referenced files at the shared location. The DLL is not copied to the load generator, saving memory use.

For each DLL that is available in a shared library, you can specify whether or not to copy it locally to the script folder.

To use shared libraries:

  1. Copy the files for the DLL to a shared location that can be accessed by the load generators.

  2. Open the Runtime Settings for the script.

  3. On the Local References page, add the path to the relevant DLL assemblies. For each DLL that you do not want added to the script, set the Copy local option to NO.

  4. On the Shared Libraries page, click Add, and define the full path to the shared library folder. Do this for each referenced DLL that you do not want copied to the local script folder.

    Note: For each assembly on the Local References page that is set to not copy to the local script folder, you must define a corresponding shared library. Otherwise, replay will fail.

  5. If the script folder contains a copy of a DLL that is now referenced from the shared library, the local copy is deleted when you replay the script.

Back to top

Replay limitations

The following limitations apply for replay of a .NET+ Vuser script:

  • Exceptions in .NET+ scripts generated by vts functions, may cause the replay to abort, even when the Continue on error runtime setting is enabled.
    Workaround: Use try and catch statements for error handling of the VTS functions.
  • .NET+ scripts that contain UI objects can behave unexpectedly during replay in VuGen, Controller, or on a load generator machine.

Back to top

See also: