Rewriting tik4net for Modern .NET

A one‑afternoon rewrite that reduced a long‑lived library to a small, modern, ~40‑file SOC‑style codebase now used in new production code.

Starting point

The original tik4net is a solid library, but it shows its age: not compatible with current RouterOS versions, multiple APIs mixed together, features I never used, and artefacts from many years of evolution. The goal was simply to create a clean .NET 10 foundation that fits current tooling and my own project needs.

First pass

I cloned the repository, unpacked it, and explained the situation to AiStudio. I did not mention async or architecture. Only the facts above. AiStudio responded with a direct plan: delete a long list of obsolete files, create a new modern solution, add an empty .NET 10 project, and use Visual Studio to correct namespaces. This took about ten minutes of manual work. The first compile produced a few errors and many warnings. I handed the diagnostics to AiStudio, and it iterated until the project built cleanly.

Smoke test

AiStudio generated a simple TestHarness for a RouterOS 7.21.3 lab router. The harness ran, but the library did not. We added low‑level logging so AiStudio could see the protocol behaviour. With real data available, it grounded itself, iterated, and fixed the remaining issues. The result was a working .NET 10 synchronous library with no comments from the harness or VS.

Direction change

Cleaning up the synchronous codebase would have been wasted effort. The plan was always to move to a fully async design. The only real discussion was convincing AiStudio to leave legacy users behind. KC.Tik4Net is a forward‑looking library, not a compatibility layer. Once aligned, AiStudio followed its usual pattern: design, plan, implement, test. By the end of the afternoon, the library had been refactored into a clean async‑only .NET 10 codebase, with the beginnings of a typed high‑level layer.

Result

KC.Tik4Net is not a continuation of tik4net. It is a modern RouterOS client built on top of the original ideas, but without the constraints of the past. The entire rewrite happened in one afternoon and produced a compact, maintainable library of around forty files that is already being used in new production systems. In earlier years, work of this scope typically required weeks of manual refactoring and protocol debugging, so the short timeline is simply a reflection of how different the tooling landscape has become.


Links
Code: https://github.com/KCTech-Lab/KC.Tik4Net
Related note: https://www.kctech.dk/notes/mactelnet