BUG: Other Language Consumers Can Change a Final Field (325450)
The information in this article applies to:
- Microsoft Visual J# .NET (2002)
This article was previously published under Q325450 SYMPTOMS Final fields in Visual J# .NET assemblies are mutable from
other .NET languages. CAUSE A bug in the Visual J# .NET compiler (Vjc.exe) and the
Visual J# .NET Binary Converter Tool (Jbimp.exe) can cause other .NET language
compilers not to recognize immutability in a Visual J# .NET field declaration.
RESOLUTION To work around this problem, manually edit the MSIL of the
Visual J# .NET assembly and add the initonly
modifier to the .field declaration of the final
field:
- At a Microsoft Visual Studio .NET command prompt, type the
following command (use your Visual J# .dll file):
ildasm /out=tmp.il js_server.dll - Edit Tmp.il in a text editor and change the following line
.field public class [vjslib]java.lang.Double d
to:
.field public initonly class [vjslib]java.lang.Double d
- Save the Tmp.il file.
- At a Visual Studio .NET command prompt, type the following
command to produce your final Visual J# .NET .dll file:
ilasm tmp.il /output=JS_Server.dll /dll /resource=tmp.res Note that changing the MSIL in this manner may cause verification
errors, which may cause problems when it runs in a security context other than
the local computer. If you do not see any verification issues after you apply
the workaround, the bug has been cleanly removed without any side effects.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 1/19/2004 |
---|
Keywords: | kbbug kbpending KB325450 kbAudDeveloper |
---|
|