Skip to content

Commit

Permalink
Fixed multiple bugs.
Browse files Browse the repository at this point in the history
• Fixed some bugs caused by missing generics checks in ReflectionExtensions.cs
• Fixed some runtime bugs caused by potentially inaccessible type definitions created by IL2CPP AOT type generation.
  • Loading branch information
JohnBaracuda committed Sep 24, 2022
1 parent c117fa8 commit da6c6cc
Show file tree
Hide file tree
Showing 9 changed files with 317 additions and 250 deletions.
239 changes: 147 additions & 92 deletions Assets/Baracuda/Monitoring.Editor/IL2CPPBuildPreprocessor.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Assets/Baracuda/Monitoring/Source/Profiles/EventProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private static Func<TTarget, string> CreateSubscriberDataExpression(Func<TTarget
sb.Append(i);
sb.Append(']');
sb.Append(' ');
sb.Append(item.Method.DeclaringType?.ToReadableTypeString().ColorizeString(settings.ClassColor) ?? "NULL".ColorizeString(Color.red));
sb.Append(item.Method.DeclaringType?.HumanizedName().ColorizeString(settings.ClassColor) ?? "NULL".ColorizeString(Color.red));
sb.Append(settings.AppendSymbol);
sb.Append(item.Method.Name.ColorizeString(settings.MethodColor));

Expand Down
16 changes: 8 additions & 8 deletions Assets/Baracuda/Monitoring/Source/Profiles/MethodProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ private MethodProfile(
MemberType.Method, args)
{
var valueProcessor = MonitoringSystems.Resolve<IValueProcessorFactory>().CreateProcessorForType<TValue>(FormatData);

var parameter = CreateParameterArray(methodInfo, attribute);
_getValueDelegate = CreateGetDelegate(methodInfo, parameter, valueProcessor, FormatData, args.Settings);
}
Expand All @@ -42,12 +42,12 @@ private static Func<TTarget, MethodResult<TValue>> CreateGetDelegate(MethodInfo
var sb = new StringBuilder();
var parameterInfos = methodInfo.GetParameters();
var parameterHandles = CreateParameterHandles(parameterInfos, format, settings);


if (methodInfo.ReturnType == typeof(void))
{
var @void = new VoidValue().ConvertFast<VoidValue, TValue>();

return target =>
{
sb.Clear();
Expand Down Expand Up @@ -102,8 +102,8 @@ private static Dictionary<int, OutParameterHandle> CreateParameterHandles(IReadO
Group = format.Group,
ElementIndent = Mathf.Max(format.ElementIndent * 2, 4)
};


var handle = OutParameterHandle.CreateForType(current.ParameterType, parameterFormat);
handles.Add(i, handle);
}
Expand All @@ -116,7 +116,7 @@ private static object[] CreateParameterArray(MethodInfo methodInfo, MonitorAttri
var parameterInfos = methodInfo.GetParameters();
var paramArray = new object[parameterInfos.Length];
var monitorMethodAttribute = attribute as MonitorMethodAttribute;

for (var i = 0; i < parameterInfos.Length; i++)
{
var current = parameterInfos[i];
Expand All @@ -127,7 +127,7 @@ private static object[] CreateParameterArray(MethodInfo methodInfo, MonitorAttri
}
else
{
var defaultValue = current.HasDefaultValue? current.DefaultValue : currentType.GetDefault();
var defaultValue = current.HasDefaultValue ? current.DefaultValue : currentType.GetDefault();
paramArray[i] = defaultValue;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected MonitorProfile(

if(settings.FilterType)
{
var readableString = MonitoredMemberType.ToReadableTypeString();
var readableString = MonitoredMemberType.HumanizedName();
tags.Add(readableString);
utility.AddTypeString(readableString);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ public void ApplyFilter(string filterString)

public void ResetFilter()
{
if (string.IsNullOrWhiteSpace(_activeFilter))
{
return;
}

_activeFilter = null;
_ticker.ValidationTickEnabled = true;
var units = _manager.GetAllMonitoringUnits();
Expand Down
2 changes: 1 addition & 1 deletion Assets/Baracuda/Monitoring/Source/Types/FormatData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ internal static IFormatData CreateFormatData(IMonitorProfile profile, IMonitorin
string MakeGroup()
{
return profile.DeclaringType.IsGenericType
? profile.DeclaringType.ToReadableTypeString()
? profile.DeclaringType.HumanizedName()
: (settings.HumanizeNames
? Humanize(profile.DeclaringType.Name)
: profile.DeclaringType.Name);
Expand Down
2 changes: 1 addition & 1 deletion Assets/Baracuda/Monitoring/Source/Units/MonitorUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public virtual void Dispose()

public override string ToString()
{
return GetType().ToReadableTypeString();
return GetType().HumanizedName();
}

#endregion
Expand Down
Loading

0 comments on commit da6c6cc

Please sign in to comment.