I would like to learn more about the HostProtectionAttribute in C#. Certainly, I read the MSDN documentations this and this but I couldn't figure out why we use it. In the documentation there are terms like "host programming model" which made the topic even more confusing for me.
Suppose that we have a method that has this attribute and what happens if I delete it?
As the documentation spells out below;
We use it to help us write predictable code in the host environment because
When you delete it, in case the method contains types or certain code constructs that maybe disallowed by the host, you will never know and as a result it may result in unpredictable behavior of your code in the host environment such as SQL server. I hope that makes it more helpful.