共用方式為


編譯器錯誤 C3274

__finally/finally 缺少對應的 try

找到缺少對應之 __finally finally try陳述式。 若要解決這個問題,請刪除 __finally 陳述式,或為 try 加入 __finally陳述式。

下列範例會產生 C3274:

// C3274.cpp
// compile with: /clr
// C3274 expected
using namespace System;
int main() {
   try {
      try {
         throw gcnew ApplicationException();
      }
      catch(...) {
         Console::Error->WriteLine(L"Caught an exception");
      }
      finally {
         Console::WriteLine(L"In finally");
      }
   } finally {
      Console::WriteLine(L"In finally");
   }

   // Uncomment the following 3 lines to resolve.
   // try {
   //   throw gcnew ApplicationException();
   // }

   finally {
      Console::WriteLine(L"In finally");
   }
   Console::WriteLine(L"**FAIL**");
}