@prefix schema: <https://schema.org/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ks: <https://comcomponent.com/vocab/> .

<https://comcomponent.com/blog/2026/03/16/005-unexpected-exception-exit-or-continue-decision-table/#article>
    schema:about <https://comcomponent.com/knowledge/unexpected-exception/>, <https://comcomponent.com/knowledge/invariant/> ;
    schema:mentions <https://comcomponent.com/knowledge/failure-unit/>, <https://comcomponent.com/knowledge/external-side-effect/>, <https://comcomponent.com/knowledge/catch-exception-antipattern/>, <https://comcomponent.com/knowledge/zombie-process/>, <https://comcomponent.com/knowledge/terminate-process/>, <https://comcomponent.com/knowledge/continue-processing/>, <https://comcomponent.com/knowledge/stackoverflowexception/>, <https://comcomponent.com/knowledge/accessviolationexception/>, <https://comcomponent.com/knowledge/outofmemoryexception/>, <https://comcomponent.com/knowledge/memory-corruption-symptom/>, <https://comcomponent.com/knowledge/environment-failfast/>, <https://comcomponent.com/knowledge/environment-exit/>, <https://comcomponent.com/knowledge/native-interop-boundary/>, <https://comcomponent.com/knowledge/backgroundservice/>, <https://comcomponent.com/knowledge/windows-service/>, <https://comcomponent.com/knowledge/stopapplication/>, <https://comcomponent.com/knowledge/unhandled-exception-handler/>, <https://comcomponent.com/knowledge/exception-recovery-attempt/> .

<https://comcomponent.com/knowledge/unexpected-exception/> a skos:Concept ;
    skos:prefLabel "想定外の例外"@ja ;
    skos:definition "NullReferenceExceptionのように処理の前提が崩れたことを示す例外で、その後も状態を信用してよいか怪しいため、request/job境界で主ログして失敗応答にすべきもの。"@ja ;
    skos:altLabel "前提崩れ"@ja ;
    ks:verifiedBy <https://comcomponent.com/knowledge/unhandled-exception-handler/> .

<https://comcomponent.com/knowledge/invariant/> a skos:Concept ;
    skos:prefLabel "不変条件"@ja ;
    skos:definition "処理の前後で必ず成り立っていなければならない、状態に関する約束のこと。"@ja ;
    skos:altLabel "Invariant" .

<https://comcomponent.com/knowledge/continue-processing/> a skos:Concept ;
    skos:prefLabel "処理の継続"@ja ;
    skos:definition "失敗した範囲を切り離し、プロセスを終了せずに処理を続ける選択のこと。"@ja ;
    skos:altLabel "継続寄りの判断"@ja ;
    ks:requires <https://comcomponent.com/knowledge/invariant/> ;
    ks:requires <https://comcomponent.com/knowledge/failure-unit/> ;
    ks:requires <https://comcomponent.com/knowledge/external-side-effect/> .

<https://comcomponent.com/knowledge/failure-unit/> a skos:Concept ;
    skos:prefLabel "失敗単位"@ja ;
    skos:definition "画面操作1回、HTTPリクエスト1本、ジョブ1件、メッセージ1件、CSVの1行など、何が1回失敗したかを表す業務上まとまりのある処理の単位。"@ja .

<https://comcomponent.com/knowledge/external-side-effect/> a skos:Concept ;
    skos:prefLabel "外部副作用"@ja ;
    skos:definition "DB更新・ファイル書き込み・メール送信・装置へのコマンド送信など、プロセスの外へ出てしまいcatchでは戻せない変更のこと。"@ja ;
    skos:altLabel "External Side Effect" .

<https://comcomponent.com/knowledge/catch-exception-antipattern/> a skos:Concept ;
    skos:prefLabel "catch (Exception)での握りつぶし"@ja ;
    skos:definition "例外の種類を区別せずcatch (Exception)で受け止め、ログだけ出して処理を続行させるアンチパターンのこと。"@ja ;
    skos:altLabel "例外種別を問わない握りつぶし"@ja ;
    ks:notRecommendedFor <https://comcomponent.com/knowledge/unexpected-exception/> .

<https://comcomponent.com/knowledge/zombie-process/> a skos:Concept ;
    skos:prefLabel "ゾンビ化"@ja ;
    skos:definition "プロセス自体は落ちていないが仕事をしていない状態のこと。最終処理時刻の停止や滞留件数の増加として観測される。"@ja ;
    skos:altLabel "Zombie Process" .

<https://comcomponent.com/knowledge/terminate-process/> a skos:Concept ;
    skos:prefLabel "プロセスの終了"@ja ;
    skos:definition "壊れた可能性のある範囲を切り離せないと判断し、プロセスを終了させる選択のこと。"@ja ;
    skos:altLabel "終了寄りの判断"@ja ;
    ks:recommendedFor <https://comcomponent.com/knowledge/stackoverflowexception/> ;
    ks:recommendedFor <https://comcomponent.com/knowledge/accessviolationexception/> .

<https://comcomponent.com/knowledge/stackoverflowexception/> a skos:Concept ;
    skos:prefLabel "StackOverflowException"@ja ;
    skos:definition "呼び出しスタックが破綻したときに送出される.NETの例外のこと。"@ja ;
    skos:altLabel "スタックオーバーフロー例外"@ja .

<https://comcomponent.com/knowledge/accessviolationexception/> a skos:Concept ;
    skos:prefLabel "AccessViolationException"@ja ;
    skos:definition "保護されたメモリへの不正アクセスが起きたときに送出される.NETの例外のこと。"@ja ;
    skos:altLabel "アクセス違反例外"@ja .

<https://comcomponent.com/knowledge/environment-failfast/> a skos:Concept ;
    skos:prefLabel "Environment.FailFast"@ja ;
    skos:definition "try/finallyとfinalizerを実行させずにプロセスを即座に終了させ、イベントログへの記録とダンプ採取を行う.NETのAPIのこと。"@ja ;
    skos:altLabel "FailFast" ;
    ks:recommendedFor <https://comcomponent.com/knowledge/outofmemoryexception/> ;
    ks:recommendedFor <https://comcomponent.com/knowledge/memory-corruption-symptom/> ;
    ks:implements <https://comcomponent.com/knowledge/terminate-process/> .

<https://comcomponent.com/knowledge/outofmemoryexception/> a skos:Concept ;
    skos:prefLabel "OutOfMemoryException"@ja ;
    skos:definition "実行を継続するためのメモリが不足したときに送出される.NETの例外のこと。"@ja ;
    skos:altLabel "メモリ不足例外"@ja .

<https://comcomponent.com/knowledge/memory-corruption-symptom/> a skos:Concept ;
    skos:prefLabel "メモリ破壊の兆候"@ja ;
    skos:definition "0xc0000005や0xc0000374でのプロセス終了、解放済みオブジェクトへのアクセス時だけ発生する異常など、メモリ破壊を疑わせる症状群のこと。"@ja ;
    skos:altLabel "ヒープ破損"@ja ;
    skos:altLabel "Heap Corruption" .

<https://comcomponent.com/knowledge/environment-exit/> a skos:Concept ;
    skos:prefLabel "Environment.Exit"@ja ;
    skos:definition "指定した終了コードでプロセスを即座に終了させる.NETの静的メソッド。"@ja ;
    skos:altLabel "Environment.Exit メソッド"@ja ;
    ks:implements <https://comcomponent.com/knowledge/terminate-process/> .

<https://comcomponent.com/knowledge/native-interop-boundary/> a skos:Concept ;
    skos:prefLabel "ネイティブ境界"@ja ;
    skos:definition "COM・P/Invoke・vendor SDKのcallbackなど、managedコードとネイティブコードが接する境界のこと。"@ja ;
    skos:altLabel "COM/P/Invoke境界"@ja ;
    skos:altLabel "Native Interop Boundary" .

<https://comcomponent.com/knowledge/backgroundservice/> a skos:Concept ;
    skos:prefLabel "BackgroundService"@ja ;
    skos:definition "IHostedServiceの書きやすい実装補助となる抽象クラスで、長く走る本体をExecuteAsyncに書ける。"@ja ;
    skos:altLabel "BackgroundService クラス"@ja ;
    ks:implements <https://comcomponent.com/knowledge/windows-service/> .

<https://comcomponent.com/knowledge/stopapplication/> a skos:Concept ;
    skos:prefLabel "IHostApplicationLifetime.StopApplication"@ja ;
    skos:definition "ホストを正常に畳むことを要求する.NETのAPIのこと。Windowsサービスとして動かす場合、呼び出すとSCMへSERVICE_STOPPEDが報告される。"@ja ;
    skos:altLabel "StopApplication" .

<https://comcomponent.com/knowledge/windows-service/> a skos:Concept ;
    skos:prefLabel "Windowsサービス"@ja ;
    skos:definition "ユーザーのサインインと無関係にバックグラウンドで動くWindowsのプロセス。"@ja ;
    skos:altLabel "サービス"@ja .

<https://comcomponent.com/knowledge/unhandled-exception-handler/> a skos:Concept ;
    skos:prefLabel "未処理例外ハンドラ"@ja ;
    skos:definition "AppDomain.UnhandledExceptionやWPFのDispatcherUnhandledException、WinFormsのThreadExceptionなど、回復ポイントではなく最後の記録地点となる、呼び出し階層の最終境界。"@ja ;
    skos:altLabel "AppDomain.UnhandledException" ;
    skos:altLabel "最後の未処理例外ハンドラ"@ja ;
    ks:notRecommendedFor <https://comcomponent.com/knowledge/exception-recovery-attempt/> .

<https://comcomponent.com/knowledge/exception-recovery-attempt/> a skos:Concept ;
    skos:prefLabel "例外後の状態回復の試み"@ja ;
    skos:definition "未処理例外ハンドラーの中でアプリの状態を直し、そのまま処理を続けようとすることのこと。"@ja ;
    skos:altLabel "ハンドラーでの状態回復"@ja .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/continue-processing/> ;
    rdf:predicate ks:requires ;
    rdf:object <https://comcomponent.com/knowledge/invariant/> ;
    schema:description "処理の継続を選ぶには、共有状態の不変条件が保たれている、またはロールバック・再初期化で回復できることを前提とする"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/continue-processing/> ;
    rdf:predicate ks:requires ;
    rdf:object <https://comcomponent.com/knowledge/failure-unit/> ;
    schema:description "処理の継続を選ぶには、1操作・1画面・1ジョブなど失敗した範囲を捨てられる明確な失敗単位が定まっていることを前提とする"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/continue-processing/> ;
    rdf:predicate ks:requires ;
    rdf:object <https://comcomponent.com/knowledge/external-side-effect/> ;
    schema:description "処理の継続を選ぶには、DB更新やファイル書き込みなどの外部副作用について送った/送っていない/再送してよいと説明できることを前提とする"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/catch-exception-antipattern/> ;
    rdf:predicate ks:mayCause ;
    rdf:object <https://comcomponent.com/knowledge/zombie-process/> ;
    schema:description "catch (Exception)で例外の種類を問わず握りつぶして継続すると、壊れた状態のまま仕事をしていないのに生きているゾンビ状態を招くことがある"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/catch-exception-antipattern/> ;
    rdf:predicate ks:notRecommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/unexpected-exception/> ;
    schema:description "catch (Exception)でログだけ出して処理を続行する対応は、原因を隠し壊れた状態を延命しやすいため、想定外の例外への対処として推奨されない"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/terminate-process/> ;
    rdf:predicate ks:recommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/stackoverflowexception/> ;
    schema:description "呼び出しスタックが破綻しており通常の回復を前提にしにくいStackOverflowExceptionには、プロセスの終了が本記事の推奨である"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/api/system.stackoverflowexception?view=net-10.0> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/terminate-process/> ;
    rdf:predicate ks:recommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/accessviolationexception/> ;
    schema:description "保護メモリへの不正アクセスでメモリ破壊が疑われるAccessViolationExceptionには、プロセスの終了が本記事の推奨である"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-accessviolationexception> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/environment-failfast/> ;
    rdf:predicate ks:recommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/outofmemoryexception/> ;
    schema:description "追加割り当て前提の回復処理自体が不安定になりやすい破局的なOutOfMemoryExceptionは、catchしてEnvironment.FailFastでアプリを終了しイベントログへ記録することが.NET公式ドキュメントでも案内されている"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/api/system.outofmemoryexception?view=net-10.0> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/accessviolationexception/> ;
    rdf:predicate ks:mayCause ;
    rdf:object <https://comcomponent.com/knowledge/memory-corruption-symptom/> ;
    schema:description "AccessViolationExceptionは保護メモリへの不正アクセスであり、0xc0000005のようなメモリ破壊が疑われる典型的な兆候を伴うことがある"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-accessviolationexception>, <https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/environment-failfast/> ;
    rdf:predicate ks:recommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/memory-corruption-symptom/> ;
    schema:description "アプリの状態が修復不能に壊れており、try/finallyやfinalizerの実行がリソースを壊してしまう場合には、Environment.FailFastを使うことが公式ドキュメントで案内されている"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/api/system.environment.failfast?view=net-10.0> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/environment-failfast/> ;
    rdf:predicate ks:implements ;
    rdf:object <https://comcomponent.com/knowledge/terminate-process/> ;
    schema:description "Environment.FailFastは、実行中のtry/finallyとfinalizerを走らせずにプロセスを即終了させる、終了の実装手段の1つである"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/api/system.environment.failfast?view=net-10.0> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/environment-exit/> ;
    rdf:predicate ks:implements ;
    rdf:object <https://comcomponent.com/knowledge/terminate-process/> ;
    schema:description "Environment.Exitは0以外の終了コードを指定してプロセスを終了させる、終了の実装手段の1つである"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/native-interop-boundary/> ;
    rdf:predicate ks:mayCause ;
    rdf:object <https://comcomponent.com/knowledge/memory-corruption-symptom/> ;
    schema:description "COM・P/Invoke・vendor SDKのcallback起点の異常はmanaged側だけでは安全性を判断しづらく、メモリ破壊の兆候を伴うことがある"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/terminate-process/> ;
    rdf:predicate ks:recommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/native-interop-boundary/> ;
    schema:description "COM・P/Invoke・vendor SDKのcallback起点の異常には、即終了から強めの終了寄りの対応が本記事の推奨である"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/backgroundservice/> ;
    rdf:predicate ks:requires ;
    rdf:object <https://comcomponent.com/knowledge/environment-exit/> ;
    schema:description "BackgroundServiceの親ループが想定外例外で落ちたとき、Windowsサービスとして動かす場合は0以外の終了コードでのEnvironment.Exitによる終了を前提とする。StopApplicationだけではSCMにSERVICE_STOPPEDが報告され回復操作が走らないため"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/stopapplication/> ;
    rdf:predicate ks:notRecommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/windows-service/> ;
    schema:description "StopApplicationは正常停止の要求であり、Windowsサービスとして動かす場合はSCMへSERVICE_STOPPEDが報告されるため、想定外例外時の終了手段としてこれだけを用いることは推奨されない"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/backgroundservice/> ;
    rdf:predicate ks:implements ;
    rdf:object <https://comcomponent.com/knowledge/windows-service/> ;
    schema:description "BackgroundServiceはWindowsサービスとしてホストされる常駐ワーカーの実装を担う.NET Generic Hostの基底クラスである"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/core/extensions/windows-service> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/unhandled-exception-handler/> ;
    rdf:predicate ks:notRecommendedFor ;
    rdf:object <https://comcomponent.com/knowledge/exception-recovery-attempt/> ;
    schema:description "AppDomain.UnhandledExceptionやDispatcherUnhandledExceptionなどの未処理例外ハンドラーは最後に記録する場所として有用だが、そこでアプリの状態を回復しようとする使い方は推奨されない"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-appdomain-unhandledexception>, <https://learn.microsoft.com/en-us/dotnet/api/system.windows.application.dispatcherunhandledexception?view=windowsdesktop-10.0> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/catch-exception-antipattern/> ;
    rdf:predicate ks:incompatibleWith ;
    rdf:object <https://comcomponent.com/knowledge/backgroundservice/> ;
    schema:description "1件ずつ処理するループでcatch (Exception)を使うと想定外例外まで飲み込んでしまい、親ループであるBackgroundService側が想定外例外を検知して終了する設計と両立しない。この非互換は、この飲み込みがBackgroundServiceの親ループへ届く経路上で起きる場合に限られる"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/exceptions/best-practices-for-exceptions> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/environment-failfast/> ;
    rdf:predicate ks:prevents ;
    rdf:object <https://comcomponent.com/knowledge/external-side-effect/> ;
    schema:description "Environment.FailFastはtry/finallyを実行しないため、壊れた状態のまま後片付けコードがファイルやDBへ誤ったデータを書き込むことを防ぐ"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/api/system.environment.failfast?view=net-10.0> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "context-dependent" .

[] a rdf:Statement ;
    rdf:subject <https://comcomponent.com/knowledge/unexpected-exception/> ;
    rdf:predicate ks:verifiedBy ;
    rdf:object <https://comcomponent.com/knowledge/unhandled-exception-handler/> ;
    schema:description "想定外の例外が最終的にどこまで届いたかは、AppDomain.UnhandledExceptionやDispatcherUnhandledExceptionのような未処理例外ハンドラーで確認できる"@ja ;
    ks:evidence <https://learn.microsoft.com/en-us/dotnet/standard/threading/exceptions-in-managed-threads> ;
    ks:verifiedAt "2026-08-01" ;
    ks:certainty "established" .
