0

Is their any way to get Object from Hash Code???

Actually the problem is I found some Binding Warning's in our application & every warning has the same source hash code. I tried searching by source name & target name but nothing such a thing is found.

So please help me to found object or style or Control Template where actually the binding Warning is coming?? Or help me to find the object on which the Warning is coming by its Hash Code.

Following binding Warning's are coming.

System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='56844144'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='64558826'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='16230876'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='40603406'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='47611344'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='6250841'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='25349309'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='35348398'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='4124450'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='21506238'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'
    System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='SkipToFill'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='33003048'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='DevExpress.Xpf.Editors.ErrorControl: DevExpress.Xpf.Grid.GridCellValidationError'; TargetElement.HashCode='18846426'; TargetElement.Type='DevExpress.Xpf.Editors.ErrorControl'

How can I get the source of these Warning's?? Can anyone help me???

Amol Bavannavar
  • 2,062
  • 2
  • 15
  • 36

2 Answers2

5

A hash function is one way, you pass it an input value, and it will always output the same value.

So no, you can't go reverse, i.e, you can't do it the other way round (generate the object back from hash). A hash function is used to map digital data of arbitrary size to digital data of fixed size, and thus there is a loss of information which is inherent to the calculation of hashcode.

That said, you question smells of the X-Y problem. I think you want to debug why the problem is happening in wpf, and as a way to figure that out you are trying to debug it back using the hashcode.

One way to resolve this would be to find out calculate the hashcode of all the objects, and compare each of them to the offensive hashcode.

You can do that using the following code:

private string GetStoryBoardNameByHashCode(int hashCode)
{
    foreach (DictionaryEntry resource in Resources)
    {
        if (resource.Value is Storyboard)
        {
            if (resource.GetHashCode() == hashCode)
                return ((Storyboard) resource.Value).Name;
        }
    }
    return String.Empty;
}

and executing it as below, as mentioned in this answer:

    string storyBoardName = GetStoryBoardNameByHashCode(65981734);

Another possiblity is a missing Stop for the Begin section, as mentioned in this answer

Also, you might want to have a look at this ticket on DevExpress.

Community
  • 1
  • 1
Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
2

The hash code is one way, you can get a hash from an object but not the other way around.

Moti Azu
  • 5,392
  • 1
  • 23
  • 32