Jwshyns.DudNet 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Jwshyns.DudNet --version 1.1.0
NuGet\Install-Package Jwshyns.DudNet -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Jwshyns.DudNet" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Jwshyns.DudNet --version 1.1.0
#r "nuget: Jwshyns.DudNet, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Jwshyns.DudNet as a Cake Addin
#addin nuget:?package=Jwshyns.DudNet&version=1.1.0

// Install Jwshyns.DudNet as a Cake Tool
#tool nuget:?package=Jwshyns.DudNet&version=1.1.0


DudNet is a C# source generator for implementing a proxy pattern.


Generating a proxy for a class is as simple as marking it with the ProxyServiceAttribute as follows:

using DudNet.Attributes;

public interface IExampleService {
       public void ExampleFunction();
       public int ExampleFunctionWithArgumentAndReturn(int number);

public class ExampleService : IExampleService {
       public void ExampleFunction(){
           // omitted for brevity
       public int ExampleFunctionWithArgumentAndReturn(int number){
           // omitted for brevity
       public void FunctionNotOnInterface(){
           // ommitted for brevity

Which would generate the following two classes:

using System.Runtime.CompilerServices;
using DudNet.Attributes;

public partial class ExampleServiceProxy : IExampleService {

	private readonly IExampleService _service;

	public void ExampleFunction() {
	public int ExampleFunctionWithArgumentAndReturn(int number) {
	partial void Interceptor([CallerMemberName]string callerName = null);

	partial void ExampleFunctionInterceptor();

	partial void ExampleFunctionWithArgumentAndReturnInterceptor(int number);


using DudNet.Attributes;

public class ExampleServiceDud : IExampleService {

    public void ExampleFunction() {
    public int ExampleFunctionWithArgumentAndReturn(int number) {


These generated classes can be used by further implementing the partial proxy class as follows:

public partial class ExampleServiceProxy : IExampleService {
    public ExampleServiceProxy(ExampleProxyService service) {
        // Some logic to determine whether you want to effectively "disable" the service
        if (Random.Shared.NextDouble() > 0.5)
            _service = service;
        _service = new ExampleServiceDud();
    partial void Interceptor([CallerMemberName]string callerName = null) {
        Console.Writeline("'{caller}' was called", callerName);
    partial void ExampleFunctionWithArgumentAndReturnInterceptor(int number) {
        if(number > 5) 
            throw new Exception("Received number value '{number}' - too high!", number);


Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 593 10/24/2023
1.1.0 461 9/15/2023
1.0.1 524 8/22/2023