Orchard.Users reference in custom module causes crash

Topics: Administration, Customizing Orchard, General, Troubleshooting, Writing modules
Aug 4, 2014 at 5:22 PM

I have noticed some strange behaviour while developing a custom module.

Part of the module lists a filtered view of users from orchard. For this I need to reference Orchard.Users.dll in order to access the userparts.

I add a reference to the assembly from modules/orchard.users/bin, I can then see the types I need in visual studio.

When I recompile my module and refresh, half of the dashboard is broken (missing menu items, various known controller routes start throwing 404s)!?!

I have tried changing "copy to local" false on the reference n visual studio, after a recycle of the app pool, the functionality is back, but I get an exception when accessing the controller action that references the type in the users assembly.

Could not load Orchard.users 1.8.0...

This suggests to me that orchard is not loading the dependency correctly.

Ive looked in the app_data log files but nothing is written when I get the crash

I am using the compiled version of orchard btw

Any ideas?
Aug 6, 2014 at 6:49 AM
'When I recompile my module' Did you do this manually in Visual Studio? If not, try a manual build in Visual Studio, then it probably will give you some errors.
Aug 7, 2014 at 10:06 PM
Yes the module I'm building is compiled via visual studio, I'm using the compiled version of orchard which doesn't do the dynamic compile of csproj.

The module works fine when comment out the lines requiring the orchard.user dependencies, soon as I add the reference to the assembly and compiled the dashboard screw up and weird things start to happen..

If only nhibernate would log something to the logs folder I might have half s chance in resolving this!
Aug 8, 2014 at 7:03 AM
Maybe its logged in the Orchard logs in App_Data/logs
Aug 8, 2014 at 8:50 AM
As I said, there is nothing written to App_data logs

It's like NHibernate just gives up, I think there is an exception being raised high up somewhere but it's being caught and discarded.
Aug 13, 2014 at 3:50 PM
have you solved it already ?
if not, try debugging with orchard source.
Aug 13, 2014 at 5:58 PM
Turn the trace for ALL in config -> log4net
<!-- If you are looking here and want more output, first thing to do is change root/priority/@value to "INFO" or "ALL". -->
    <!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF. -->
    <priority value="ERROR" />
    <appender-ref ref="error-file" />
Aug 13, 2014 at 8:48 PM
Thanks for the input guys on this.

@arjunatantri - no I haven't resolved it, I had to move on as it was taking too much time to figure out the issue. I will try against the source at the weekend as I don't have time in the week to set up the environment

@CSADNT - I've set to "ALL" and run it in working mode and when it breaks, apart from the fact that tons of lines of debug text is logged, there is a major difference in the size of the two files. When in working mode, the .log file is 25mb, when broken it's only 10mb. Which suggests something is failing. I've searched for a few strings "ERROR" and ".Users", but nothing really jumps out at me - is there something I should be looking for specifically?

If I cannot figure this out I will probably have to do what I'm tyring to do a different way without referencing the assembly directly I guess, shame!
Aug 14, 2014 at 9:31 AM
for development, i disable the try catch in InvokeExtensions.cs
and use the new compilation of orchard.framework.dll
it's much more convenient for me.
Aug 14, 2014 at 10:21 AM
You should rather add a project reference instead of directly referencing the Orchard.Users DLL.