Fix #2957375 (C#) - SWIGStringHelper and SWIGExceptionHelper not always being initialized before use in .NET 4 as the intermediary class was not marked as beforefieldinit.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12044 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-05-23 22:24:36 +00:00
commit a4febe7799
2 changed files with 24 additions and 0 deletions

View file

@ -1,6 +1,22 @@
Version 2.0.0 (in progress)
============================
2010-05-23: wsfulton
[C#] Fix #2957375 - SWIGStringHelper and SWIGExceptionHelper not always being
initialized before use in .NET 4 as the classes were not marked beforefieldinit.
A static constructor has been added to the intermediary class like this:
%pragma(csharp) imclasscode=%{
static $imclassname() {
}
%}
If you had added your own custom static constructor to the intermediary class in
the same way as above, you will have to modify your approach to use static variable
initialization or define SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR - See csharphead.swg.
*** POTENTIAL INCOMPATIBILITY ***
2010-05-23: wsfulton
Fix #2408232. Improve shared_ptr and intrusive_ptr wrappers for classes in an
inheritance hierarchy. No special treatment is needed for derived classes.

View file

@ -319,6 +319,14 @@ SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_$module(SWIG_CSharpString
%}
#endif // SWIG_CSHARP_NO_STRING_HELPER
#if !defined(SWIG_CSHARP_NO_IMCLASS_STATIC_CONSTRUCTOR)
// Ensure the class is not marked beforefieldinit
%pragma(csharp) imclasscode=%{
static $imclassname() {
}
%}
#endif
%insert(runtime) %{
/* Contract support */