Bug 48257 - ilasm chokes with "irrecoverable syntax error" on ".data cil"
Summary: ilasm chokes with "irrecoverable syntax error" on ".data cil"
Status: RESOLVED FIXED
Alias: None
Product: Tools
Classification: Mono
Component: other ()
Version: 4.6.0 (C8)
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-29 04:33 UTC by Vladimir Panteleev
Modified: 2016-11-29 21:10 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Vladimir Panteleev 2016-11-29 04:33:22 UTC
Both Microsoft .NET ildasm and Mono ikdasm can emit output such as:

.data cil I_00002050 = bytearray ( [...] )

However, Mono ilasm (version 4.6.1.0) chokes on the above line, with the message "irrecoverable syntax error". Microsoft .NET ilasm parses the file without any problems.

Full example:

###########################
$ cat > test.il <<'EOF'
.module 'test.dll'
.imagebase 0x00400000
.file alignment 0x00000200
.stackreserve 0x00100000
.subsystem 0x0003       // WINDOWS_CUI
.corflags 0x00000001    //  ILONLY

.data cil I_00002050 = bytearray (
                 02 00 00 00 03 00 00 00 03 00 00 00 04 00 00 00
                 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00)
EOF

$ ilasm -DLL test.il
Assembling 'test.il' , no listing file, to dll --> 'test.dll'

test.il (8, 10) : Error : irrecoverable syntax error

***** FAILURE *****

$ WINEDEBUG=-all wine ~/.wine/drive_c/windows/Microsoft.NET/Framework/v2.0.50727/ilasm.exe -NOLOGO -DLL test.il 

Assembling 'test.il'  to DLL --> 'test.dll'
Source file is ANSI

Creating PE file

Emitting classes:

Emitting fields and methods:
Global 	

Emitting events and properties:
Global 	
Writing PE file
Operation completed successfully

###########################

This bug has been previously filed on the Novell bugtracker 6 years ago, and apparently has not been fixed or migrated to this bugtracker since then: https://bugzilla.novell.com/show_bug.cgi?id=636785

This bug can be a blocker where ildasm/ilasm are used for automated patching in a server environment.
Comment 1 Vladimir Panteleev 2016-11-29 21:10:49 UTC
Fixed in https://github.com/mono/mono/pull/4041.