Error loading extension Orchard.Email HttpCompileException EmailMessagingChannel.cs

Jan 18, 2011 at 4:36 PM

So after I had this problem http://orchard.codeplex.com/Thread/View.aspx?ThreadId=242264

I had yet another problem with orchard.exe, when I loaded it up It throws  up an error like the log below.

Log is Below, because I fixed this myself! =D

I opened c:\inetpub\wwwroot\orchard\Modules\Orchard.Email\Services\EmailMessagingChannel.cs(37) << error on line 37

The original line 37 --> using (var smtpClient = new SmtpClient()) {

Change it to : using (SmtpClient smtpClient = new SmtpClient()) {

Fixed! (For me at-least) run orchard.exe again it loads up fine! =)

Orchard.Email is written by the orchard team right? I wonder if I should put this as an issue?

Here is the log:

2011-01-18 21:32:05,257 [1] Orchard.Environment.Extensions.ExtensionManager - Error loading extension 'Orchard.Email'System.Web.HttpCompileException (0x80004005): c:\inetpub\wwwroot\orchard\Modules\Orchard.Email\Services\EmailMessagingChannel.cs(37): error CS1674: 'System.Net.Mail.SmtpClient': type used in a using statement must be implicitly convertible to 'System.IDisposable'   at System.Web.Compilation.AssemblyBuilder.Compile()   at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()   at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)   at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)   at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)   at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate)   at System.Web.Compilation.BuildManager.GetCompiledAssembly(String virtualPath)   at Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader.LoadWorker(ExtensionDescriptor descriptor) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\Extensions\Loaders\DynamicExtensionLoader.cs:line 173   at Orchard.Environment.Extensions.ExtensionManager.BuildEntry(ExtensionDescriptor descriptor) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 132   at Orchard.Environment.Extensions.ExtensionManager.<>c__DisplayClass18.<LoadFeature>b__13(AcquireContext`1 ctx) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 83   at Orchard.Caching.Cache`2.CreateEntry(TKey k, Func`2 acquire) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Caching\Cache.cs:line 41   at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory)   at Orchard.Caching.Cache`2.Get(TKey key, Func`2 acquire) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Caching\Cache.cs:line 15   at Orchard.Environment.Extensions.ExtensionManager.LoadFeature(FeatureDescriptor featureDescriptor) in d:\TeamCity\Projects\Orchard-1.x\src\Orchard\Environment\Extensions\ExtensionManager.cs:line 82

Hope it helped someone!?

 

Coordinator
Jan 18, 2011 at 7:15 PM

This sounds weird, and I'm unable to reproduce it, but yes, you should file a bug and probably attach this patch. Please give as much detail as you can on how to reproduce.

Jan 18, 2011 at 7:59 PM
Edited Jan 18, 2011 at 8:01 PM

I just happened to install the Email and Messaging modules today, then I was reading the code gen article on the wiki, and I enabled the CodeGen feature. 

When I finally got to running orchard.exe it pops up with this problem.

Does orchard.exe do a dynamic compile or something since the log is a compile error? Or Is it a C#/BCL thing, because from what I googled/learnt is SmtpClient is IDisposable only as of .NET v4?

Ok, I'm a little excited about a patch, first time I'll be doing one and I'm very happy that codeplex has mercurial! =D

 

 

Jan 18, 2011 at 8:29 PM

Funnily now I'm not able to re-produce it too, or something random is happening. Anyway, its very late so I'll look at this tomorrow morning.