Tutorial :getting CS1502 compiler error on dev environment but not production


When I try to run my ASP.NET app from my development environment I get the following error message: Compiler Error Message: CS1502: The best overloaded method match for 'mmars.Printing.printFunctions.SetPrintSummaryProperties(mmars.contextInfo, ref mmars.Printing.printObjSummary)' has some invalid arguments.

When I publish and run on our production server I don't get this error.

It seems to compile fine when I build from the build menu (in fact if I change the second argument of the bolded function call below, i get a compiler error in visual studio), but now i've suddenly started getting this error message at runtime. So another question I have in addition to getting rid of the error is why is the .NET development server even trying to do JIT compilation on my project if it is already compiled into a DLL?

Printing.printObjSummary myPrintObj = new Printing.printObjSummary(); Printing.printFunctions.SetPrintSummaryProperties(ci, ref myPrintObj); printObjects.Add(myPrintObj);

This seems to have just suddenly appeared from nowhere today and it's extremely frustrating.

Also, though there are no warnings at compile-time, when I get redirected to the page with that first compilation error there are many warnings like the following:

Warning: CS0436: The type 'mmars.MMARSSummaryDataItem' in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\3dad423c\40569048\App_Code.b0rgpkzr.4.cs' conflicts with the imported type 'mmars.MMARSSummaryDataItem' in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\3dad423c\40569048\assembly\dl3\7179c19a\345f948c_ece7ca01\mmars.DLL'. Using the type defined in 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\3dad423c\40569048\App_Code.b0rgpkzr.4.cs'.

What's the deal with that? Is the webserver complaining about name conflicts in the source file and dll resulting from the source file?


Turns out the solution to this problem was simply renaming my App_Code folder to something else. Apparently the development web-server tries to do JIT compilation on stuff in a folder called App_Code, even if all the members of those files already exist in the compiled assembly, which is what was causing this problem.


Have you tried clearing the Temporary ASP.NET Files? It's possible a cached version of an assembly is out of sync or something...

Another possibility (remote), is that the old version of the dll is in your Assembly Cache?

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »