Why do I keep stumbling into more and more ASP.NET bugs?
Consider the following code. What it attempts to do is to expire all the cookies. Simple right? Notice that the loop runs only for as many cookies as there are present in the Request. However, it appeared that the following code actually causes an infinite loop to occur.
Can you figure out why?
for(int i=0;i<Request.Cookies.Count;i++){Response.Cookies[Request.Cookies[i].Name].Value = "";Response.Cookies[Request.Cookies[i].Name].Expires = DateTime.MinValue;}
In order to replicate the above situation, drop the above code into a Page's Load event. Make sure that you've actually allocated a cookie or two before running the code above.
In 2017, with the release of Delphi 10.2 Tokyo, Embarcadero introduced a specialized implementation of the Observer pattern into the System.Classes unit. While it has been in the wild for 9 years, it remains a "hidden" architecture for many, primarily because it serves as the invisible engine behind LiveBindings. Other than live bindings, you can also use the Observer pattern as a way to update component settings to the Windows registry, an .ini file, or persist it elsewhere.
System.Classes