Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is AppDomainSetup.ShadowCopyFiles a string?

From the documentation:

A String containing the string value "true" to indicate that shadow copying is turned on; or "false" to indicate that shadow copying is turned off.

And its been this way since 1.1. Can anyone shed any light?

I reflector'd the getter and setter for good measure:

public string ShadowCopyFiles
{
    get
    {
        return this.Value[8];
    }
    set
    {
        if ((value != null) && (string.Compare(value, "true", StringComparison.OrdinalIgnoreCase) == 0))
        {
            this.Value[8] = value;
        }
        else
        {
            this.Value[8] = null;
        }
    }
}

//The referenced Value property...

internal string[] Value
{
    get
    {
        if (this._Entries == null)
        {
            this._Entries = new string[0x10];
        }
        return this._Entries;
    }
}

private string[] _Entries; 

So maybe the Value array begets an easier copy constructor or something?

like image 995
Jason Punyon Avatar asked Dec 07 '09 19:12

Jason Punyon


1 Answers

Lack of caffeine. Some things are not meant to be understood.

This clearly seems to be a mistake from .NET first version, not fixed because that could break "legacy" code.

Gosh, I just found this:

Thanks for your feedback on the .NET Framework! We agree that this is an oversight and that the property type should be a boolean. However, it is quite difficult (if not impossible) to make this change in a backwards compatible release (such as Orcas), because we would break the code of any customer relying on string comparisons. So unfortunately we must weigh the risk of breaking compatibility vs. the benefits of API cleanliness...and when it comes to best supporting our customer base, the former typically wins. We will track this internally as a good thing to improve and we'll continue to consider it in future releases.

From here

like image 117
Rubens Farias Avatar answered Oct 24 '22 19:10

Rubens Farias