New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.4.rc1: Search function does not locate method #1387

Closed
greenozon opened this Issue Jan 8, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@greenozon
Copy link

greenozon commented Jan 8, 2019

ILSpy version 4.0.0.4517-rc1

Search for this method:

<Module>.DynamicArray<BCSYM_MethodDecl *>.Grow

0 results found, but method is inside the assembly.

(BTW, it has some decompiling issue and I've just copy-pasted it's name from assert stack trace)

target:

// C:\WINDOWS\Microsoft.NET\assembly\GAC_32\Microsoft.VisualBasic.Activities.Compiler\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.Activities.Compiler.dll
// Microsoft.VisualBasic.Activities.Compiler, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// Global type:
// Architecture: x86
// This assembly contains unmanaged code.
// Runtime: v4.0.30319
// This assembly is signed with a strong name key.
// Hash algorithm: SHA1
// Public key: 02400480009400062000240052534131040010107d1fa57c4aed9f0a32e84aafaefdde9e8fd6aec8f87fb3766c834c99921eb23be79ad9d5dcc1dd9ad2361321290b723cf980957fc4e177108fc67774f29e832e92ea5ece4e821c0a5efe8f1645c4cc93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaffc4963d261c8a12436518206dc093344d5ad293

Expected result: end-user will be able to find the method

@siegfriedpammer

This comment has been minimized.

Copy link
Member

siegfriedpammer commented Jan 8, 2019

The problem is that the search term contains spaces, which ILSpy then interprets as two independent search terms. You can now use " to force ILSpy to parse the search term correctly. Note that when using regular expressions you have to wrap the whole expression in ", i.e. "/regularExpression/". Note that closing quotes and slashes are optional.

@dgrunwald

This comment has been minimized.

Copy link
Member

dgrunwald commented Jan 8, 2019

But both independent search terms occur in the member name, so should the search still find it?

@siegfriedpammer

This comment has been minimized.

Copy link
Member

siegfriedpammer commented Jan 8, 2019

The problem is: as soon as there are multiple search terms there is no way to activate full name search. So both search terms are only compared against the method names rather than full names.

if (terms.Length == 1 && terms[0].Length > 2) {
string search = terms[0];
if (search.StartsWith("/", StringComparison.Ordinal) && search.Length > 4) {
var regexString = search.Substring(1, search.Length - 1);
fullNameSearch = search.Contains("\\.");
if (regexString.EndsWith("/", StringComparison.Ordinal))
regexString = regexString.Substring(0, regexString.Length - 1);
regex = SafeNewRegex(regexString);
} else {
fullNameSearch = search.Contains(".");
}
}
searchTerm = terms;

Should I add

fullNameSearch = terms.Any(t => t.Contains("."));

in the other case?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment