Adding a custom action to ActionsMenu on Microsoft.SharePoint.StandardMenu for List, the {ListId} token in Url of UrlAction gets different data depending on "where the list is".
Here is the way to find this bug:
1) create a feature and deploy it on sharepoint server. for example:
<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="Test.ActionsMenu"
RegistrationType="List"
GroupId="ActionsMenu"
Location="Microsoft.SharePoint.StandardMenu"
ImageUrl="/_layouts/images/icon_document.gif"
Sequence="10"
Title="Test"
Description="">
<UrlAction Url="JavaScript:window.location='{SiteUrl}/_layouts/test.aspx?listid={ListId}'"/>
</CustomAction>
</Elements>
2) find a list/document library (suppose its name is ALIST), browse to its default view: ...ALIST/Forms/AllItems.aspx, from Actions menu, click the customAction you setup, note the ListID refers to ALIST listID, that is expected.
3)Create a web part page and save this page in a different document library, add a web part by finding ALIST under Lists and Libraries, from this web part's Full Toolbar, click the same actionmenu, note that ListID refers to the document library where the page is stored, not the list the web part refers to (ALIST)
4) You can also find another list/document library (BLIST), browse to its default view ...BLIST/Forms/AllItems.aspx, edit this page,
add ALIST web part, from its Full Toolbar's Actions Menu, click the custom action, please note the {ListID} now refers to BLIST