Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSC : error CS7038: Failed to emit module

After installing Visual Studio 2015 and building my project I receive the error

"CSC : error CS7038: Failed to emit module".

However my solution is building fine in Visual Studio 2013.

It is an ASP.NET webforms project .NET 4.0

Anyone?

UPDATE: it looks like the problem has to do with Red Gate Smart Assembly in combination with method parameters with default values.

UPDATE: Smart Assembly 6.9 fixes the error for me.

like image 982
Orlando Helmer Avatar asked Jul 29 '15 06:07

Orlando Helmer


2 Answers

Original Snippet:

    private void radButton1_Click(object sender, EventArgs e)
    {
        string perp = radTextBox1.Text;

        int i = 0;
        DataRow arp = ale.Rows[i];
        while (i <= ale.Rows.Count)
        {
            if (ale.Rows[i].Field<>("FullName") = perp)
            {
                arp = ale.Rows[i];
                ale.Rows.Remove(arp);
            }

        }

        i = ale.Rows.Count;
        radLabel1.Text = i.ToString();
    }

Changed this:

    if (ale.Rows[i].Field<>("FullName") = perp)

To This:

    if (ale.Rows[i].Field<String>("FullName") == perp)
like image 137
Scooter Avatar answered Oct 20 '22 04:10

Scooter


Got the same error (fresh installation of the VS2015 Enterprise, ASP.NET webforms project .NET 4.0).

After some investigation I've found that there are two DLLs in references which causes this. Both are .Net 2.0 assemblies and both of them obfuscated by Red Gate Smart Assembly 6.5. And the real reason is... obfuscation.

Luckily, these assemblies are mine, so I've tried to build them without using of Smart Assembly - error is gone.

Interesting is that no any errors or warnings shown by Visual Studio before trying to build a project.

Good luck!

EDIT: Updating Smart Assembly to version 6.9 fixed an issue.

like image 7
Andrey Ivashov Avatar answered Oct 20 '22 04:10

Andrey Ivashov