Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions managed/src/SwiftlyS2.Core/Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private static IntPtr SteamAPIDLLResolver( string libraryName, Assembly assembly
public static void Start( IntPtr nativeTable, int nativeTableSize, string basePath, string logPath )
{
Environment.SetEnvironmentVariable("SWIFTLY_MANAGED_ROOT", basePath);
Environment.SetEnvironmentVariable("SWIFTLY_MANAGED_LOG", logPath);
NativeBinding.BindNatives(nativeTable, nativeTableSize);
NativeLibrary.SetDllImportResolver(typeof(NativeMethods).Assembly, SteamAPIDLLResolver);

Expand Down
3 changes: 3 additions & 0 deletions managed/src/SwiftlyS2.Core/Misc/SwiftlyLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ public void Log<TState>( LogLevel logLevel, EventId eventId, TState state, Excep
if (exception != null)
{
FileLogger.LogException(exception, exception.Message);
// Temporarily use a reasonable width for exception output to avoid visual empty lines
AnsiConsole.Profile.Width = 200;
AnsiConsole.WriteException(exception);
AnsiConsole.Profile.Width = 13337;
}

AnsiConsole.Reset();
Expand Down
106 changes: 106 additions & 0 deletions managed/src/TestPlugin/TestPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using SwiftlyS2.Shared.SchemaDefinitions;
using SwiftlyS2.Shared.ProtobufDefinitions;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SwiftlyS2.Shared.Events;
using SwiftlyS2.Shared.Memory;
Expand Down Expand Up @@ -1136,6 +1137,111 @@ public void LineOfSightCommand( ICommandContext context )
.ForEach(targetPlayer => context.Reply($"Line of sight to {targetPlayer.Controller!.PlayerName}: {player.PlayerPawn!.HasLineOfSight(targetPlayer.PlayerPawn!)}"));
}

[Command("ex1")]
public void DeepExceptionCommand( ICommandContext _ )
{
[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel1()
{
ThrowLevel2();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel2()
{
ThrowLevel3();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel3()
{
ThrowLevel4();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel4()
{
ThrowLevel5();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel5()
{
ThrowLevel6();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel6()
{
ThrowLevel7();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel7()
{
ThrowLevel8();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel8()
{
ThrowLevel9();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel9()
{
ThrowLevel10();
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowLevel10()
{
try
{
ThrowInnerLevel1();
}
catch (Exception ex)
{
throw new Exception("Deep nested exception from level 10", ex);
}
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowInnerLevel1()
{
try
{
ThrowInnerLevel2();
}
catch (Exception ex)
{
throw new InvalidOperationException("Inner exception level 1", ex);
}
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowInnerLevel2()
{
try
{
ThrowInnerLevel3();
}
catch (Exception ex)
{
throw new ArgumentException("Inner exception level 2", ex);
}
}

[MethodImpl(MethodImplOptions.NoInlining)]
void ThrowInnerLevel3()
{
throw new NullReferenceException("Root cause exception");
}

ThrowLevel1();
}

public override void Unload()
{
Console.WriteLine("TestPlugin unloaded");
Expand Down
Loading