In theory, you can develop what you need in safe code, but let me assume that you have good reason to use unsafe code :)
In the parts of the code in which you run unsafe code, you risk forgetting to free up memory, etc., so if you manage the memory well, you should have no problem. When you have a C # project using COM + dll, you do this all the time. Itβs better in your case, because you own all the code so that you can fix any memory leak if you can detect it.
If you collect all unsafe codes in a separate library
PROFI
- You can create a new secure library in the future.
- If you see that the dll does not work in the execution logs, you can more easily isolate the source of the problem.
Cons
- Deteriorated reading of your code if you need to split safe / insecure code in an unnatural way.
So, your honest decision. If I were you, I would split the unsafe code into another project, in order to be able to replace it with safe code if necessary.
source share