Server crash when trying to send a class in function

blacksmith_craft := class<concrete>:

    var AgentCanvas : [agent]canvas = map{}
    var AgentWeaponIndex : [agent]int = map{}

    Logger : log = log{Channel := BLACKSMITH_CRAFT_LOG}

    Weapons : []blacksmith_craft_weapon = array:
        blacksmith_craft_weapon:
           item := weaponitem.HeistedRunAndGunL7
           res1 := conditional.Gold
           price1 := 1
           res2 := conditional.Gold
           price2 := 1
           res3 := conditional.Gold
           price3 := 1
           Texture := ResourcePNG.WOOD}

    AddNewUI<private>(Agent : agent):void=
        Logger.Print("Add New UI")
        if(PlayerUI := GetPlayerUI[player[Agent]], Weapon := Weapons[AgentWeaponIndex[Agent]]):
            NewCanvas := MakeNewCanvas(Agent, Weapon)
            PlayerUI.AddWidget(NewCanvas)
            if(set AgentCanvas[Agent] = NewCanvas):
                Logger.Print("Success set new UI for agent")

    MakeNewCanvas<private>(Agent : agent, Weapon : blacksmith_craft_weapon):canvas=

        Logger.Print("Make New UI")

        Canvas := canvas:
            Slots := array:
                canvas_slot:
                    Anchors := anchors:
                        Minimum := vector2{X:= 0.0, Y:= 0.0}
                        Maximum := vector2{X:= 0.0, Y:= 0.0}
                    Widget := texture_block:
                        DefaultImage := Weapon.Texture #Problem with texture
                        DefaultDesiredSize := vector2{X:= 300.0, Y:= 300.0}

blacksmith_craft_weapon := class:

    item : weaponitem
    res1 : conditional
    price1 : int
    res2 : conditional
    price2: int
    res3 : conditional
    price3 : int
    Texture : texture