Skip to content

Commit

Permalink
[DotNetDiver] Fix "types" dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
sssssdsddd committed Nov 22, 2024
1 parent 133c6a6 commit fed6193
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions src/ScubaDiver/DotNetDiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,10 @@ protected override void RefreshRuntime()
}
catch(Exception ex)
{
if (ex.Message.Contains("is not running."))
if (ex.Message.Contains("is not running.") ||
ex.Message.Contains("Access is denied."))
{
// This is ok.
// These are ok.
}
else
{
Expand Down Expand Up @@ -472,27 +473,22 @@ protected override string MakeTypesResponse(ScubaDiverMessage req)
// No matching assemblies found
return QuickError($"No assemblies found matching the query '{assemblyFilter}'");
}
else if (matchingAssemblies.Count > 1)
{
return $"{{\"error\":\"Too many assemblies found matching the query '{assemblyFilter}'. Expected: 1, Got: {matchingAssemblies.Count}\"}}";
}

// Got here - we have a single matching assembly.
Assembly matchingAssembly = matchingAssemblies.Single();


List<TypesDump.TypeIdentifiers> types = new List<TypesDump.TypeIdentifiers>();
foreach (Type type in matchingAssembly.GetTypes())
foreach (Assembly matchingAssembly in matchingAssemblies)
{
// TODO: Is checking both FullName and Name overkill?
if (!typeFilterPredicate(type.FullName) && !typeFilterPredicate(type.Name))
continue;

types.Add(new TypesDump.TypeIdentifiers()
foreach (Type type in matchingAssembly.GetTypes())
{
Assembly = matchingAssembly.FullName,
FullTypeName = type.FullName
});
// TODO: Is checking both FullName and Name overkill?
if (!typeFilterPredicate(type.FullName) && !typeFilterPredicate(type.Name))
continue;

types.Add(new TypesDump.TypeIdentifiers()
{
Assembly = matchingAssembly.GetName().Name,
FullTypeName = type.FullName
});
}
}

TypesDump dump = new()
Expand Down

0 comments on commit fed6193

Please sign in to comment.