3
Vote

OAProperties.Item can't find "URL" index

description

I'm creating a language service for a simple DSL. While working in the experimental hive, MPFProj quite often throws an exception in OAProperties.Item when the index argument equals "URL". The call stack shows nothing but [External Code] and this function. The exception occurs when I close the solution or exit Visual Studio, but it also occurs sometimes when I open the project. I can't seem to determine the origin of the "URL" property, why it's needed, or how to provide it.

comments

kobrigo wrote Mar 29, 2009 at 11:37 AM

I did not slove the issue I just added the missing attribute so stop the exeptions for now. Here is what I did.
I have added in the file NodeProperties.cs on the class NodeProperties the following attribute which solved the issue:
    [SRCategoryAttribute(SR.Misc)]
    [LocDisplayName(SR.URL)]
    [SRDescriptionAttribute(SR.URL)]
    public string URL
    {
        get
        {
            return this.Node.Url;
        }
    }
Hope this helps you

wrote Apr 9, 2009 at 9:56 PM

cmaxo wrote Apr 9, 2009 at 10:01 PM

I confirmed that by adding the code from kobrigo as a property on NodeProperties the exception goes away. Can anybody explain why the samples don't have this issue or where the root of the problem comes from? I feel dirty having this little hack and no explanation.

Thanks,
cmaxo

cmaxo wrote Apr 27, 2009 at 10:12 PM

I found a solution to this problem without having to modify the cs files provided by this project. The file type that I was adding needed to have a class that "presents" properties to visual studio and that class needs to have a "public string URL..." property. The class that I created that subclasses from FileNode has this method now:

protected override NodeProperties CreatePropertiesObject()
{
  MyFileNodeProperties properties = new MyFileNodeProperties(this);
  properties.OnCustomToolChanged += new EventHandler<HierarchyNodeEventArgs>(OnCustomToolChanged);
  properties.OnCustomToolNameSpaceChanged += new EventHandler<HierarchyNodeEventArgs>(OnCustomToolNameSpaceChanged);
  return properties;
}
And MyFileNodeProperties has among other things the URL property.

Corey

wrote Feb 12, 2010 at 3:39 PM

wrote Feb 13, 2013 at 10:30 PM