Talk:ASP.NET (tutorial)

From Nemerle Homepage

On Windows, I have not been able to get this to work with Cassini (using web.config). I only get the error "cannot load assembly with macros `Nemerle.Macros'". Registering Nemerle.Macros with gacutil, placing it in the current directory and the bin/ directory, and adding it with <add assembly="Nemerle.Macros" /> are all to no avail. -- Chuck 00:55, 4 May 2006 (CEST)


Using xsp2 on windows, I actually get same error with less pretty reporting but ultimately more useful feedback, including the whole generated source file.

Error message: (0,0) : warning : assembly `C:\apps\mono\lib\mono\gac\System\2.0.0.0__b77a5c561934e089\System.dll' already loaded (0,0) : error : cannot load assembly with macros `Nemerle.Macros' C:\DOCUME~1\CHARLE~1\LOCALS~1\Temp\charles_adams-temp-aspnet-0\af74bcd6\32212.0.n(53,13) : error : parse error near keyword `when': unexpected keyword in expression context C:\DOCUME~1\CHARLE~1\LOCALS~1\Temp\charles_adams-temp-aspnet-0\af74bcd6\32212.0.n(53,61) : error : expected `;' C:\DOCUME~1\CHARLE~1\LOCALS~1\Temp\charles_adams-temp-aspnet-0\af74bcd6\32212.0.n(53,61) : error : parse error near `{...}' group: unexpected token after expression in sequence

The offending line it hilights is the first one using a macro.

Line 52:         public this () {
Line 53:             when ((ASP.nemerle_aspx.__intialized == false)) {
Line 54:                 ASP.nemerle_aspx.__intialized = true;
Line 55:             }
Line 56:         }

The fact that it fails on windows in exactly the same fashion whether using MS.NET or Mono suggests to me that there's some platform-specific problem in LookupAssembly being called from Nemerle.Compiler.LibraryReferenceManager.LoadMacrosFrom.

Gripes: The exception handling and reporting idiom in LoadMacrosFrom is absolutely atrocious, flattening at least two errors into null and then throwing away the original exception and presenting an uninformative error message instead. I'm not sure how to run this in a debugger, so it's going to be an incredibly tedious and slow task to track down what's going on, and I'm not sure I have the time for any of it. I may just have to stick with VB and C# in pages and only use nemerle to create precompiled assemblies, which defeats the rapid development features that brought me to Nemerle in the first place. -- Chuck 22:28, 4 May 2006 (CEST)


Continuing results of my investigation ...

I tried recompiling LibraryReferenceManager.LookupAssembly to remove all the exception->null shenanigans, and this kept ncc from even bootstrapping. Not wanting to figure out how to skip bootstrapping, I crossed my fingers and started selectively commenting out exceptions. Luckily, the first one I picked, FileNotFoundException, seemed to do the trick, and now I get a bona-fide error (no traceback, but oh well). This is what I get from both Cassini and xsp2:

Compiler Error Message: : Could not load file or assembly 'Nemerle, Version=0.9.2.0, Culture=neutral, PublicKeyToken=e080a9c724e2bfcd' or one of its dependencies. The system cannot find the file specified.

I don't have 0.9.2.0 installed. At all. gacutil reports that I have version 0.9.2.28904 and only that version. I got rid of all instances of Nemerle*.dll from my PATH, unregistered all Nemerle assemblies, reinstalled the snapshot versions of Nemerle with the tweak installed, use the proper version number in the <compiler> tag in web.config ... but I still get this error. What kills me is that Nemerle.dll is already loaded by Cassini, as I can tell from using Process Explorer. I can't figure out what's possessing it to look for the wrong version, and only on windows at that.

I'm deeper down the rabbit hole and now I'm truly in DLL Hell. -- Chuck 23:17, 4 May 2006 (CEST)


Last update for a while: I found out that a .* version always maps to .0 for some reason, and doesn't appear to mean "any" version. I don't know enough about .NET versioning and strong names and the assembly loader and so on to understand it. So I decided to stop trying to figure out version numbers and just replaced the version 0.9.2.* assembly versions in the source with 0.9.2.54321 and loading them that way ... no dice, still found itself looking for 0.9.2.0 for some reason, so I finally just broke down and used 0.9.2.0 for all versions, set my web.config appropriately ...

And I got the catch-all "cannot load assembly with macros" error again. I'm out of patience, and someone else will have to figure all this out. -- Chuck 00:26, 5 May 2006 (CEST)

tree
  • ASP.NET (tutorial)
remember
You are very welcome to contribute to the documentation here!