Sündmused
17. märts, 21 - 21. märts, 10
Liituge sarjaga, et luua muude arendajate ja ekspertidega skaleeritavad tehisintellektilahendused, mis põhinevad reaalajas kasutusjuhtumitel.
Registreeruge koheSeda brauserit enam ei toetata.
Uusimate funktsioonide, turbevärskenduste ja tehnilise toe kasutamiseks võtke kasutusele Microsoft Edge.
A previous catch clause already catches all exceptions. All exceptions thrown will be wrapped in a System.Runtime.CompilerServices.RuntimeWrappedException
This attribute causes CS1058 if a catch()
block has no specified exception type after a catch (System.Exception e)
block. The warning advises that the catch()
block will not catch any exceptions.
A catch()
block after a catch (System.Exception e)
block can catch non-CLS exceptions if the RuntimeCompatibilityAttribute
is set to false in the AssemblyInfo.cs file: [assembly: RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)]
. If this attribute is not set explicitly to false, all thrown non-CLS exceptions are wrapped as Exceptions and the catch (System.Exception e)
block catches them. For more information, see How to catch a non-CLS exception.
The following example generates CS1058.
// CS1058.cs
// CS1058 expected
using System.Runtime.CompilerServices;
// the following attribute is set to true by default in the C# compiler
// set to false in your source code to resolve CS1058
[assembly: RuntimeCompatibilityAttribute(WrapNonExceptionThrows = true)]
class TestClass
{
static void Main()
{
try {}
catch (System.Exception e) {
System. Console.WriteLine("Caught exception {0}", e);
}
catch {} // CS1058. This line will never be reached.
}
}
Toote „.NET“ tagasiside
.NET on avatud lähtekoodiga projekt. Tagasiside andmiseks valige link:
Sündmused
17. märts, 21 - 21. märts, 10
Liituge sarjaga, et luua muude arendajate ja ekspertidega skaleeritavad tehisintellektilahendused, mis põhinevad reaalajas kasutusjuhtumitel.
Registreeruge kohe