Using dynamic libraries in the revit add-in

I have created an add-in for revit, inside which I transform the Revit geometry.DB to Autodesk geometry.Design Script.Geometry, so that Dynamo methods can be applied.
Here is an example of the code

using System.Windows.Media.TextFormatting;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autodesk.Revit.DB;

using Autodesk.DesignScript.Geometry;
using Autodesk.Revit.UI;
using Autodesk.Revit.ApplicationServices;
using Autodesk.Revit.UI.Selection;
using Dynamo;
using RevitServices.Persistence;
using RevitServices.Transactions;
using Autodesk.Revit.Attributes;

namespace Интеграция_Динами
{
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
class Helper : IExternalCommand
{

    public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
    {

        UIApplication uiapp = commandData.Application;
        UIDocument uidoc = uiapp.ActiveUIDocument;
        Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
        Document doc = uidoc.Document;


        #region Core Logic

        IList<Reference> refElementsA;
        try
        {
            refElementsA = uidoc.Selection.PickObjects(ObjectType.Face, "Please pick elements (set A)");
        }
        catch (Autodesk.Revit.Exceptions.OperationCanceledException)
        {
            return Result.Cancelled;
        }

        //TransactionManager.SetupManager();

        // this is must-do assignmet so that we can use wrapper functions
        DocumentManager.Instance.CurrentUIDocument = uidoc;
        List<Revit.Elements.Element> elementSetA = Helper.GetWrappedElements(refElementsA, doc);

        Revit.Elements.Element F = elementSetA[0];
        Autodesk.DesignScript.Geometry.Surface[] SF = F.Faces;
        #endregion
        //this is must do call as wrapper function opens an transaction but doesn't close it.
        //if not called an error will be shown to the user after excuting the command.
        TransactionManager.Instance.ForceCloseTransaction();
        return Result.Succeeded;

    }

    /// <summary>
    /// this is our helper method DocumentManager. Instance. CurrentUIDocument = uidoc must be setted before calling this function.
    /// </summary>
    /// <param name="refElements"></param>
    /// <param name="mainDoc"></param>
    /// <returns></returns>
    public static List<Revit.Elements.Element> GetWrappedElements(IList<Reference> refElements, Document mainDoc)
    {
        List<Revit.Elements.Element> result = new List<Revit.Elements.Element>();
        foreach (var refElement in refElements)
        {
            var rvtElement = mainDoc.GetElement(refElement);
            result.Add(Revit.Elements.ElementWrapper.Wrap(rvtElement, false));
        }

        return result;
    }
}

}

On the 52nd line of the code, it constantly gives an error, I don’t understand it.
Help me figure it out.

Gives the following error:

System.NotImplementedException: Initializer of type
"Autodesk.DesignScript.Geometry.ProtoGeometryConfigurationManage
r’ threw an exception.
in Autodesk.DesignScript.Geometry.HostFactory.get_Factory)
in Autodesk.DesignScript.Geometry.Point.ByCoordinates(Double x,
Doubley, Double z)
in Revit.GeometryConversion.RevitToProtoCurve.Convert(Line crv)
to Revit.GeometryConversion.RevitToProtoCurve.ToProtoType(Curve
revitCurve, Boolean performHostUnitConversion, Reference
referenceOverride)
Revit.GeometryConversion.RevitToProtoFace.EdgeLoopsAsPolyCurves(Fa
ce face, iEnumerable’1 edgeLoops)
in Revit.GeometryConversion.RevitToProtoFace.ToProtoType(Face
revitFace, Boolean performHostUnitConversion, Reference
referenceOverride)
in System.Ling.Enumerable.d_61’3.MoveNext)
in System.Linq.Enumerable.d_17’2.MoveNext()
in System.Linq.Buffer’1…ctor(!Enumerable 1 source)
in System.Linq.Enumerable.toArray[TSource](IEnumerable’1 source)
in integration_dins.Helper.Execute(ExternalCommandData
commandData, String& message, ElementSet elements) in
C:\Users\войтенков\Google Drive\VS\Dynamo Integration
2.0\Dynamo 2.0 integration\Helper.cs:line 52
in AddInManager.AIM.RunActiveCommand(ExternalCommandData
data, String&message, ElementSet elements)