ClojureCLR abides by the same restrictions on submitting code as the main 
Clojure project.  Meaning that contribute code directly to ClojureCLR, you 
need a Contributor Agreement with Rich Hickey.
Check out http://clojure.org/contributing.
Doing so will allow you access to the JIRA site, which is also used by 
ClojureCLR for submitting patches, etc.

In the meantime, I'll look into this problem.

-David


On Wednesday, January 16, 2013 8:38:44 PM UTC-6, gavin.ca...@gmail.com 
wrote:
>
> (This is my first post.  Please let me know if I've got the protocol 
> wrong.)
>
> First, I don't know that anyone else is even trying to run ClojureCLR in 
> ASP.NET.  All I've seen is this 
> post<https://groups.google.com/d/topic/clojure/np3sRVTMrS4/discussion>from 
> March 2010.  It looks like the recommended patch (to RT.cs) was 
> eventually incorporated.
>
> But I found that two other modifications were needed to use the current 
> version (1.4):
>
> (Note that these only came up when loading Clojure in ASP.NET.  I had no 
> problems with console programs.)
>
> 1) *Can't locate assemblies in "bin"*.  RT.load only looks for assemblies 
> in "AppDomain.CurrentDomain.BaseDirectory".  For ASP.NET applications, 
> this is the root of the site, and assemblies are located under "bin".  I 
> did the following in RT.cs to get around this:
>
> @@ -3122,6 +3122,14 @@ namespace clojure.lang
>  
>              bool loaded = false;
>  
> +            // Look for assembly alongside this one
> +            if (assyInfo == null && cljInfo == null) {
> +                Uri codeBase;
> +
> +                if 
> (Uri.TryCreate(Assembly.GetExecutingAssembly().CodeBase, UriKind.Absolute, 
> out codeBase)
> +                    && codeBase.IsFile)
> +                    assyInfo = 
> FindFile(Path.GetDirectoryName(codeBase.LocalPath), assemblyname);
> +            }
> +
>              if ((assyInfo != null &&
>                  (cljInfo == null || assyInfo.LastWriteTime > 
> cljInfo.LastWriteTime)))
>
> Assembly location was changed in changeset 02607349 to use a non-probing 
> path (although the paths returned by GetFindFilePaths() wouldn't locate in 
> bin, either).  ASP.NET includes "bin" in the standard probing path, but I 
> think you have to actually load it for that to work.
>
> 2)  *Static initialization error*.  After that, loading the assembly 
> results in the following error
>
> System.Reflection.TargetInvocationException: Exception has been thrown by 
> the target of an invocation. ---> System.TypeInitializationException: The 
> type initializer for '__Init__' threw an exception. ---> 
> System.NullReferenceException: Object reference not set to an instance of 
> an object.
>   at clojure.lang.Compiler.FindDuplicateType(String typename) in 
> \Clojure\Clojure\CljCompiler\Compiler.cs:line 866
>   at clojure.lang.RT.classForName(String p) in 
> \Clojure\Clojure\Lib\RT.cs:line 2720
>   at __Init__.__static_ctor_helper_constants()
>   at __Init__..cctor()
>   --- End of inner exception stack trace ---
>   at __Init__.Initialize()
>   --- End of inner exception stack trace ---
>   at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo 
> method, Object target, Object[] arguments, SignatureStruct& sig, 
> MethodAttributes methodAttributes, RuntimeType typeOwner)
>   at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo 
> method, Object target, Object[] arguments, Signature sig, MethodAttributes 
> methodAttributes, RuntimeType typeOwner)
>   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
> invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, 
> Boolean skipVisibilityChecks)
>   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags 
> invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
>   at System.RuntimeType.InvokeMember(String name, BindingFlags 
> bindingFlags, Binder binder, Object target, Object[] providedArgs, 
> ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
>   at System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder 
> binder, Object target, Object[] args)
>   at clojure.lang.Compiler.LoadAssembly(FileInfo assyInfo) in 
> \Clojure\Clojure\CljCompiler\Compiler.cs:line 1275
>
> Without getting too deep into the 
> code<http://clojure.org/patches?responseToken=172419b0a608c93e78a91b42fd5283b5>,
>  
> this is apparently due to the lexical order of the static initializers.  It 
> goes away if you move the following line in Compiler.cs to the top of the 
> class:
>
>         static Dictionary<String, Type> _duplicateTypeMap = new 
> Dictionary<string, Type>();
>
> Presumably, "FindDuplicateType" is in the call chain of a static 
> initializer that appears above it — at least when running in ASP.NET.
>
> So I'm up and running now, but I'd like to help out if possible.
>
> Thanks,
> Gavin
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Reply via email to