public bool TryFindByCode(ulong code, out DwarfAbbreviationItem item) failed
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- csharp
- Domain
- reverse-engineering
Research direction
Start with DwarfAbbreviation.cs around line 87 and inspect TryFindByCode, including how the map and list are used. Reproduce the reported failure and determine which code-to-item indexing behavior is expected; done means the method consistently returns the correct item or false, with a regression test covering the failure.
Written by the indexing model from the issue text.
Description
in DwarfAbbreviation.cs line 87;
`public bool TryFindByCode(ulong code, out DwarfAbbreviationItem item)
{
item = null;
if (code == 0)
{
return `false;
}
code--;
if (_mapItems.Count > 0)
{
return _mapItems.TryGetValue(code, out item);
}
if (code < int.MaxValue && (int)code < _items.Count)
{
item = _items[(int) code];
return true;
}
item = null;
return false;
}`
I found sometimes it failed at return _mapItems.TryGetValue(code, out item);
Then I fixed below; I do not konw if you have the same problem;
`public` bool TryFindByCode(ulong code, out DwarfAbbreviationItem item)
{
item = null;
if (code == 0)
{
return false;
}
//no need to minus 1
//code--;
if (_mapItems.Count > 0)
{
return _mapItems.TryGetValue(code, out item);
}
//if _mapItems is empty, try _items;
if (code < int.MaxValue && (int)code <= _items.Count)
{
item = _items[(int) code - 1];
return true;
}
item = null;
return false;
}
- Dominant language
- C#
- Stars
- 184
- Forks
- 17
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from xoofx/LibObjectFile
-
question
Difficulty 3/5 1-2 days Newbie friendliness 20/100
xoofx/LibObjectFile#43 ·
-
enhancement Help Welcome
Difficulty 5/5 Over a week Newbie friendliness 25/100
xoofx/LibObjectFile#40 ·
-
enhancement Help Welcome
Difficulty 5/5 Over a week Newbie friendliness 25/100
xoofx/LibObjectFile#39 · 1 comment ·
-
enhancement Help Welcome
Difficulty 5/5 Over a week Newbie friendliness 20/100
xoofx/LibObjectFile#37 ·
-
enhancement Help Welcome
Difficulty 4/5 3-5 days Newbie friendliness 35/100
xoofx/LibObjectFile#36 · 2 comments ·
All issues in xoofx/LibObjectFile
Similar issues
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
t/bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
ci-failure-cause test-failure
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
area:auth FE mvp P3
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
klasolsson81/jobbliggaren#1788 ·