|
14 | 14 | using SwiftlyS2.Shared.SchemaDefinitions; |
15 | 15 | using SwiftlyS2.Shared.ProtobufDefinitions; |
16 | 16 | using System.Diagnostics.CodeAnalysis; |
| 17 | +using System.Runtime.CompilerServices; |
17 | 18 | using System.Runtime.InteropServices; |
18 | 19 | using SwiftlyS2.Shared.Events; |
19 | 20 | using SwiftlyS2.Shared.Memory; |
@@ -1137,6 +1138,111 @@ public void LineOfSightCommand( ICommandContext context ) |
1137 | 1138 | .ForEach(targetPlayer => context.Reply($"Line of sight to {targetPlayer.Controller!.PlayerName}: {player.PlayerPawn!.HasLineOfSight(targetPlayer.PlayerPawn!)}")); |
1138 | 1139 | } |
1139 | 1140 |
|
| 1141 | + [Command("ex1")] |
| 1142 | + public void DeepExceptionCommand( ICommandContext _ ) |
| 1143 | + { |
| 1144 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1145 | + void ThrowLevel1() |
| 1146 | + { |
| 1147 | + ThrowLevel2(); |
| 1148 | + } |
| 1149 | + |
| 1150 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1151 | + void ThrowLevel2() |
| 1152 | + { |
| 1153 | + ThrowLevel3(); |
| 1154 | + } |
| 1155 | + |
| 1156 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1157 | + void ThrowLevel3() |
| 1158 | + { |
| 1159 | + ThrowLevel4(); |
| 1160 | + } |
| 1161 | + |
| 1162 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1163 | + void ThrowLevel4() |
| 1164 | + { |
| 1165 | + ThrowLevel5(); |
| 1166 | + } |
| 1167 | + |
| 1168 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1169 | + void ThrowLevel5() |
| 1170 | + { |
| 1171 | + ThrowLevel6(); |
| 1172 | + } |
| 1173 | + |
| 1174 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1175 | + void ThrowLevel6() |
| 1176 | + { |
| 1177 | + ThrowLevel7(); |
| 1178 | + } |
| 1179 | + |
| 1180 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1181 | + void ThrowLevel7() |
| 1182 | + { |
| 1183 | + ThrowLevel8(); |
| 1184 | + } |
| 1185 | + |
| 1186 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1187 | + void ThrowLevel8() |
| 1188 | + { |
| 1189 | + ThrowLevel9(); |
| 1190 | + } |
| 1191 | + |
| 1192 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1193 | + void ThrowLevel9() |
| 1194 | + { |
| 1195 | + ThrowLevel10(); |
| 1196 | + } |
| 1197 | + |
| 1198 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1199 | + void ThrowLevel10() |
| 1200 | + { |
| 1201 | + try |
| 1202 | + { |
| 1203 | + ThrowInnerLevel1(); |
| 1204 | + } |
| 1205 | + catch (Exception ex) |
| 1206 | + { |
| 1207 | + throw new Exception("Deep nested exception from level 10", ex); |
| 1208 | + } |
| 1209 | + } |
| 1210 | + |
| 1211 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1212 | + void ThrowInnerLevel1() |
| 1213 | + { |
| 1214 | + try |
| 1215 | + { |
| 1216 | + ThrowInnerLevel2(); |
| 1217 | + } |
| 1218 | + catch (Exception ex) |
| 1219 | + { |
| 1220 | + throw new InvalidOperationException("Inner exception level 1", ex); |
| 1221 | + } |
| 1222 | + } |
| 1223 | + |
| 1224 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1225 | + void ThrowInnerLevel2() |
| 1226 | + { |
| 1227 | + try |
| 1228 | + { |
| 1229 | + ThrowInnerLevel3(); |
| 1230 | + } |
| 1231 | + catch (Exception ex) |
| 1232 | + { |
| 1233 | + throw new ArgumentException("Inner exception level 2", ex); |
| 1234 | + } |
| 1235 | + } |
| 1236 | + |
| 1237 | + [MethodImpl(MethodImplOptions.NoInlining)] |
| 1238 | + void ThrowInnerLevel3() |
| 1239 | + { |
| 1240 | + throw new NullReferenceException("Root cause exception"); |
| 1241 | + } |
| 1242 | + |
| 1243 | + ThrowLevel1(); |
| 1244 | + } |
| 1245 | + |
1140 | 1246 | public override void Unload() |
1141 | 1247 | { |
1142 | 1248 | Console.WriteLine("TestPlugin unloaded"); |
|
0 commit comments