Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Niels Lynggaard 172 posts 469 karma points
    Jul 08, 2013 @ 16:44
    Niels Lynggaard
    0

    Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute from assembly mscorlib....

    Hi Guys.

    I've recently went through a longer line of upgrades to get an old site up to date. I also updated contour to latest version.

    However, the site throws an error when it tries to render forms on the frontend:

    Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    I googled around and found out that the attribute was moved from System.Core.dll to mscorlib.dll in .NET 4.5..

    But does Contour now require that I install .net 4.5 on my server/hotel?

    OR could something else be messing this up for me?

    Hope for a speedy resolvment, this is my last speedbump in the update row.

    Thanx!

    /Niels

  • Niels Lynggaard 172 posts 469 karma points
    Jul 08, 2013 @ 23:44
    Niels Lynggaard
    0

    Still pondering and wondering ..

    Now it turns out that its actually running fine on my local machine, but once I push the website to my dev server it doesn't..

    I know that the licens is valid to localhost also, so running boths sites as localhost, but still same. Not working on dev server, working fine locally.. Very strange indeed.

    I'm beginning to suspect some kind of server misconfig..

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 09, 2013 @ 13:02
    Tim Geyssens
    0

    Hey Niels,

    No Contour should run fine on asp.net 4 might be that mvc 4 isn't installed

    Can you tell me the Umbraco version you are running?

  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 13:24
    Niels Lynggaard
    0

    Hi Tim

    I'm running Umbraco 6.1.1

    Its quite possible that MVC 4 isn't installed on my dev box.. I'll look into that :)

    Cheers,

    Niels

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 09, 2013 @ 13:40
    Tim Geyssens
    0

    Ok but then Umbraco should also be having issues (are you using mvc as the render engine or webforms ?)

  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 13:48
    Niels Lynggaard
    0

    I'm using good oldfasioned webforms :) And Umbraco is running fine in every other respect..

    Wierd thing is that it runs ok locally, so I thing there's some misconfiguration on the server..

    But I'm installing MVC 4 now, so fingers crossed.

  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 13:50
    Niels Lynggaard
    0

    So far no luck..

    Here's a little stack-trace if that gives you any further hints?

     

    [TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
       System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
       System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +525
       System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +19
       System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +315
       System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +208
       System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1171
       System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +146
       System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +103
       System.Web.UI.ScriptResourceMapping.GetDefinition(ScriptReference scriptReference) +203
       System.Web.UI.ScriptEffectiveInfo..ctor(ScriptReference scriptReference) +96
       System.Web.UI.ScriptReference.get_ScriptInfo() +48
       System.Web.UI.ScriptManager.AddFrameworkScript(ScriptReference frameworkScript, List`1 scripts, Boolean webFormsWithoutAjax) +260
       System.Web.UI.ScriptManager.AddFrameworkScripts(List`1 scripts) +273
       System.Web.UI.ScriptManager.RegisterScripts() +207
       System.Web.UI.ScriptManager.OnPagePreRenderComplete(Object sender, EventArgs e) +281
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4543
    
  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 09, 2013 @ 14:32
    Tim Geyssens
    0

    Yeah not sure doesn't seem to be from something contour or umbraco specific

  • David Brendel 749 posts 2816 karma points c-trib
    Jul 09, 2013 @ 15:53
    David Brendel
    0

    Hey

    got nearly the same error when trying to install Contour under Umbraco 6.1.2.2

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 09, 2013 @ 16:59
    Tim Geyssens
    0

    Hmm can't reproduce, @david is this also on a specific machine?

  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 22:57
    Niels Lynggaard
    0

    This gets stranger.

    I moved the site to the test-server. Now, on the test-server I get the same error ONCE on the login, but it dissapeared on refresh. Then the same error happened in the content-tree when I tried to open a node... But only ONCE. Then I can open everything...

    I haven't setup permissions on all the folders needed yet, only on web.config at app_data.. (I was just iin the middle of doing the folder permissions through plesk desktop since I don't have server access)..

    This leeds me to the idea that maybe this is permission-related? I'm going to do some more setup and testing on the test-site and try to illiminate this error and figure out what causes it..

  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 23:23
    Niels Lynggaard
    0

    And once more on the "publish entire site" dialogue.. out of the blue, since It worked just minutes ago..


    Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    Source Error:

    Line 28: 
    Line 29:     <form id="form1" runat="server">
    Line 30: <asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server"></asp:ScriptManager> Line 31:         <asp:ContentPlaceHolder ID="body" runat="server">
    Line 32:         </asp:ContentPlaceHolder>

  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 23:37
    Niels Lynggaard
    0

    More info, this time from when it popped up in the "Create New" dialogue in the content-tree..(domain-name removed for client-protection...)

    [TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
       System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
       System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180
       System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192
       System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +115
       System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +426
       System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
       System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
       System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
       System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +399
       System.Web.UI.ScriptManager..ctor() +26
       ASP.umbraco_masterpages_umbracodialog_master.__BuildControlScriptManager1() in c:\inetpub\vhosts\XXXXXXXXXXXXXXXXXXXXX.dk\httpdocs\umbraco\masterpages\umbracoDialog.Master:30
       ASP.umbraco_masterpages_umbracodialog_master.__BuildControlform1() in c:\inetpub\vhosts\XXXXXXXXXXXXXXXXXXX.dk\httpdocs\umbraco\masterpages\umbracoDialog.Master:29
       ASP.umbraco_masterpages_umbracodialog_master.__BuildControlTree(umbraco_masterpages_umbracodialog_master __ctrl) in c:\inetpub\vhosts\XXXXXXXXXXXXXXXXXXXXXXXX.dk\httpdocs\umbraco\masterpages\umbracoDialog.Master:1
       ASP.umbraco_masterpages_umbracodialog_master.FrameworkInitialize() in c:\windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\4fc8d6fc\9b41de57\App_Web_umbracodialog.master.a29f75f4.ntk6_i26.0.cs:0
       System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
       System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8965522
       System.Web.UI.Page.get_Master() +54
       System.Web.UI.Page.ApplyMasterPage() +15
       System.Web.UI.Page.PerformPreInit() +45
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328

  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 23:38
    Niels Lynggaard
    0
  • Niels Lynggaard 172 posts 469 karma points
    Jul 09, 2013 @ 23:58
    Niels Lynggaard
    0

    Sorry for spamming.. Heres a bit of an update.

    My pages with forms on the test-server also throws this error.. dammit. So no error locally, but on both my available servers I get this error..

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 00:09
    Niels Lynggaard
    0

    Hmm.. Maybe the fact that I build the site on a machine that HAS .net 4.5 makes the difference..

    Reading material on that kind of thing: http://marcgravell.blogspot.co.nz/2012/09/iterator-blocks-missing-methods-and-net.html

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:06
    Tim Geyssens
    0

    Keep up the spamming would like to know what is causing it :)

  • David Brendel 749 posts 2816 karma points c-trib
    Jul 10, 2013 @ 10:07
    David Brendel
    0

    @Tim, it's on my local machine. So no server or anything involved yet.

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:12
    Tim Geyssens
    0

    Ok and is the .net 4.5 framework installed? on the machines having the issue

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:18
    Tim Geyssens
    0

    Hmm might be an issue on our build server, will take a look

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:21
    Tim Geyssens
    0

    Any chance you guys can try to install the previous version of Contour and see if it also happens with that one (3.0.12)

    You can get it here http://nightly.umbraco.org/Umbraco%20Contour/3.0.12/

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:23
    Tim Geyssens
    0

    Hmm it isn't the build server, thought it might have been this but it isn't http://marcgravell.blogspot.co.nz/2012/09/iterator-blocks-missing-methods-and-net.html (since the reference assembies are available)

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:24
    Tim Geyssens
    0

    So if someone could try the previous Contour release that would be really helpfull :) You can get it here http://nightly.umbraco.org/Umbraco%20Contour/3.0.12/

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:25
    Tim Geyssens
    0

    Hmm or maybe those reference assemblies are missing on the machines having the issue

    Do you have the following folder available

    C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0 ?

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 10:30
    Niels Lynggaard
    0

    Yeah, that was the next thing I was going to try.. I'll give it a go and see if it works ok.. Hopefully that will solve it.

    I'll give it a go and let you know.

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:32
    Tim Geyssens
    100

    @Niels could you first try to install Contour 3.0.12, please :) think I found the code change that might be causing it

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:34
    Tim Geyssens
    0

    And if that version works on your machine I can fix it from my end :)

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 10:35
    Niels Lynggaard
    0

    Ok, I'll do that.. When you say install, is it then ok if I just overwrite the umbraco dll's and other files?

    If you found the change and I can fix my site I OWE you beer!

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:36
  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:38
    Tim Geyssens
    0

    Fingers crossed :) 

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 10:47
    Niels Lynggaard
    0

    PURE GENIUS, IT WORKS!!!

     

    I owe you beer! Big time!! #H5YR!

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:49
    Tim Geyssens
    0

    So 3.0.12 works, ok thanks for confirming, I'll do a new release today 3.0.14 (removing the code change that is acting up)

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 10:55
    Tim Geyssens
    0

    3.0.14 release is on it's way :)

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 11:08
    Tim Geyssens
    0

    OK 3.0.14 is out would be great if you could also test that version :) http://nightly.umbraco.org/Umbraco%20Contour/3.0.14/

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 11:12
  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 11:57
    Niels Lynggaard
    0

    I'm afraid that I still get the same YSOD after upgrade to 3.0.14..

    As these links suggests, I think this *may* happen sometimes when code is compiled on a machine that has .net 4.5, even though the project explicitly uses 4.0.. Give it a read if you havent allready:

    http://www.mattwrock.com/post/2012/02/29/What-you-should-know-about-running-ILMerge-on-Net-45-Beta-assemblies-targeting-Net-40.aspx

    http://stackoverflow.com/questions/13748055/could-not-load-type-system-runtime-compilerservices-extensionattribute-from-as

    https://connect.microsoft.com/VisualStudio/feedback/details/726702/moving-system-runtime-compilerservices-extensionattribute-to-mscorlib-breaks-structuremap-scans-of-namespaces-containing-extensionmethods-and-possibly-other-ioc-scenarios

    For now I'll just put 3.0.12 on the site and be happy...

    Heres a stacktrace from v. 3.0.14

     

    [TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.] System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0 System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +525 System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +19 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +315 System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +208 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1171 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +146 System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +103 System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +592 System.Web.UI.ScriptManager..ctor() +30 Umbraco.Forms.UI.Usercontrols.RenderForm.OnInit(EventArgs e) +256 System.Web.UI.Control.InitRecursive(Control namingContainer) +133 System.Web.UI.Control.AddedControl(Control control, Int32 index) +277 umbraco.presentation.templateControls.Macro.CreateChildControls() +1844 System.Web.UI.Control.EnsureChildControls() +182 System.Web.UI.Control.InitRecursive(Control namingContainer) +133 System.Web.UI.Control.AddedControl(Control control, Int32 index) +277 umbraco.presentation.templateControls.<>c__DisplayClass6.<ParseMacros>b__2(String macroAlias, Dictionary`2 attributes) +516 Umbraco.Core.Macros.MacroTagParser.ParseMacros(String text, Action`1 textFoundCallback, Action`2 macroFoundCallback) +819 umbraco.presentation.templateControls.ItemRenderer.ParseMacros(Item item) +225 umbraco.presentation.templateControls.ItemRenderer.Load(Item item) +170 umbraco.presentation.templateControls.Item.OnLoad(EventArgs e) +33 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 12:29
    Niels Lynggaard
    0

    As you asked previously, just to clarify; This happens on machines that doesn't have ,net 4.5 framework, my local machine that does is fine..

    I say, blame this one on Microsoft ;)

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 12:45
    Tim Geyssens
    0

    Dammit well I'm just removing one more thing but then I'm out of ideas :)

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 12:54
    Tim Geyssens
    0

    Ok can I ask you one final thing, try this version (it's newer than the latest) http://nightly.umbraco.org/Umbraco%20Contour/3.0.14/

    And let me know if it still happens with that one

  • Ric Carey 42 posts 83 karma points
    Jul 10, 2013 @ 12:55
    Ric Carey
    0

    Im getting the same issue as the OP with umbraco v4.11.

    So install 3.0.12 instead? Are there any features that would be missing or is the differnce in versions just big fixes?

    Ric

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 12:56
    Tim Geyssens
    0

    Hey Ric,

    Could you try this version http://nightly.umbraco.org/Umbraco%20Contour/3.0.14/

  • Ric Carey 42 posts 83 karma points
    Jul 10, 2013 @ 12:58
    Ric Carey
    0

    Hi Tim,

    Its hit the same runtime error, im afraid.

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 12:59
    Tim Geyssens
    0

    Hey Ric the one on the build server is newer (just out a couple of minutes) is that the one you tried?

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 12:59
    Niels Lynggaard
    0

    Sure, I'll give the newer v. 3.0.14 a spinn :) *fingers crossed*

  • Ric Carey 42 posts 83 karma points
    Jul 10, 2013 @ 13:01
    Ric Carey
    0

    I downloaded and then install local package: http://nightly.umbraco.org/Umbraco Contour/3.0.14/UmbracoContour_3.0.14.zip

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 13:07
    Niels Lynggaard
    0

    Same error on a fresh upgrade zip from nightly, I'm afraid :/

    Happy to help, Tim, I'll test anything you want :)

    /Niels

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 13:08
    Tim Geyssens
    0

    ok thanks for confirming guys 

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 13:09
    Tim Geyssens
    0

    Yeah stick to 3.0.12 then for the time being, will update when I find out more

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 13:21
    Tim Geyssens
    0

    Ok seems to be due to installing .net framework 4.5 on our build server, trying to fix it now

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 13:43
    Niels Lynggaard
    0

    Yep, I think that must be it, as the links I posted also suggests this..

    Wouldn't this possibly concern a bunch of other packages that gets built on the build-server then?

    I hope you nail it like a BOSS and I STILL owe you beer :)

    /Niels

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 14:40
    Tim Geyssens
    1

    Ok can I bother you guys to do 1 more test

    http://nightly.umbraco.org/Umbraco%20Contour/3.0.14/

    and let me know if this one works?

    Thanks for al the help :)

  • Niels Lynggaard 172 posts 469 karma points
    Jul 10, 2013 @ 15:34
    Niels Lynggaard
    2

    Confirmed kill!

    I updated on my box that doesn't have .net 4.5 installed and whoila! It works, the error is gone!

    Thanx!

     

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 15:36
    Tim Geyssens
    0

    Woot, thanks again for the help :)

  • Ric Carey 42 posts 83 karma points
    Jul 10, 2013 @ 16:12
    Ric Carey
    1

    That installed for me fine, Nice one Tim.

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 10, 2013 @ 16:14
    Tim Geyssens
    0

    Great thanks for confirming @Ric :)

  • Darren Ferguson 1019 posts 3255 karma points MVP c-trib
    Jul 15, 2013 @ 08:54
    Darren Ferguson
    0

    Hi Tim,

    Was this issue to do with ILMerge and .net 4.5? I Think we have a similar issue with Workflow.

     

     

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jul 15, 2013 @ 09:13
    Tim Geyssens
    0

    @Darren, nope our build server was targetting .net 4.5 after that was installed on in, nothing to do with ILMerge in our case

  • Dan Okkels Brendstrup 101 posts 197 karma points
    Jan 06, 2014 @ 15:46
    Dan Okkels Brendstrup
    0

    I'm still getting this error on a fresh Umbraco 6.1.6 install with Contour 3.0.18, on a server that only has .NET 4.0 (and no trace of 4.5).

    I have installed 3.0.12 which works, but can't the problem be fixed in 3.0.18 as well? Is the build still targeting 4.5 to be compatible with Umbraco 7, and thus breaking compatibility with Umbraco 6?

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jan 07, 2014 @ 16:53
    Tim Geyssens
    0

    Hmm 3.0.18 might be different since that has a 4.5 project in there, if it's on umbraco v6 try removing the v7 providers assembly and see if that fixes it

  • MK 426 posts 902 karma points
    Jan 21, 2014 @ 13:34
    MK
    0

    Ok so Im having the same problem on 6.1.6. 

    I had to uninstall the 3.0.18 and install the 3.0.12.

    Any idea?

    Thanks

    Moshe

  • Patrick 14 posts 54 karma points
    Jan 22, 2014 @ 17:06
    Patrick
    0

    I get the same error on umbraco 6.1.6 and contour 3.0.18.

  • Tim Geyssens 6419 posts 15041 karma points MVP 2x c-trib
    Jan 22, 2014 @ 17:09
    Tim Geyssens
    0

    Yeah due to not having .net framework 4.5 so consider upgrading or remove the v7 assembly

  • Wouter 49 posts 76 karma points
    Feb 07, 2014 @ 10:59
    Wouter
    1

    Just found this post...I'm running into the same problem with countour 3.0.18. Please CHANGE the 4.5 project to 4.0 or change it on the download page: http://our.umbraco.org/projects/umbraco-pro/contour. For 3.0.18 it says it works with .NET 4.0 and it does not, please change it to 4.5 so people know what they are getting into. I've got a big mess on my hands now because of this :(

    The problem is actually not umbraco, but the .NET 4.5 framework. If you build a 4.0 project on a machine with 4.5 installed and them move that build to a server that does NOT have 4.5 installed > it will (depending on the resources used) crash. This is due to a change in 4.5. Some items were moved from System.Core.dll in 4.0 to mscorlib.dll in .NET 4.5 (one of them is System.Runtime.CompilerServices.ExtensionAttribute) which causes these problems...

    EDIT:
    Removing the v7 (and v6) core dll's makes no diffrence. 

  • Martin Lingstuyl 202 posts 379 karma points
    Feb 18, 2014 @ 10:47
    Martin Lingstuyl
    0

    Same problem here guys. Contour 3.0.19 and umbraco 6.1.6

    I can't upgrade the server, deleting the v7 dll's does not work.

     

    What to do?

    Tim, which version is best to downgrade to?

     

    Martin

  • Dan Okkels Brendstrup 101 posts 197 karma points
    Feb 21, 2014 @ 13:13
    Dan Okkels Brendstrup
    0

    Just tried installing 3.0.19 (on Umbraco 6.1.6) hoping that this had been fixed, but no dice. Even though it is listed as working on 6.1.x and requiring .NET 4.0 here: http://our.umbraco.org/projects/umbraco-pro/contour.

    Can we please get a recent version of this (paid!) product that works correctly on the latest 6.x on .NET 4.0?

  • Laurence Gillian 595 posts 1210 karma points
    Mar 05, 2014 @ 11:59
    Laurence Gillian
    0

    This is kinda a problem if you've got a XP and can't upgrade to NET 4.5.

    Peace out! Laurence

  • Oscar Jurado 5 posts 25 karma points
    Sep 29, 2014 @ 16:18
    Oscar Jurado
    0

    Hi all,

    I'm trying using Contour for a project we're developing, to check if it's allright with our needs.

    I've tried on Umbraco v6.1.2 (and v.6.2.1 on other machine) not having .net framework 4.5 installing  Contour versions 3.0.21, 3.0.20, 3.0.19, 3.0.14 and all of them fails. And everytime I installed a version, I had to restore a previous backup, because uninstall doesn't work :''(

    At last, it works with v.3.0.12...

    Reading all this topic, and suffering this issue to get it installed, I can't believe that this paid product is listed as working with NET 4.0, and it's fails if you don't install an old version... If this does not fix, I think we will not acquire Contour.

    Please, answer with a "real" solution. Thank's

  • Jose Cerqueiro 20 posts 79 karma points
    Mar 17, 2015 @ 22:52
    Jose Cerqueiro
    0

    Hi guys,

    Any chance this will be fixed ?

    It seems to be a matter of doing some tuning to ILMerge

    http://www.hurryupandwait.io/blog/what-you-should-know-about-running-ilmerge-on-net-4-5-assemblies-targeting-net-4-0
    http://stackoverflow.com/questions/13748055/could-not-load-type-system-runtime-compilerservices-extensionattribute-from-as#13750130

    ... or recompiling on a server without .NET 4.5 installed

    We are unable to upgrade the server in the short term. In the meantime,
    we would like to offer customers the best products available but it is
    hard to explain to them why the package fails in 4.0 when the spec
    says otherwise.

    Best regards, 

    P.S:

    This problem has been reported multiple times here, here and here.

    Furthermore, issue CON-159 3.0 fails on install (need .net 4.5?)
    was marked as "fixed" due in v.3.0.1 but it reappeared in v.3.0.13 up to v.3.0.25

  • karen 186 posts 461 karma points
    May 12, 2015 @ 22:55
    karen
    0

    HI - I am having this issue as well, still with Umbraco v6.2.5 and Umbraco Contour version 3.0.26. Using the latest version of Contour to fix other issues (specifically file upload in IE)

    I get the ysod when attempting to access Umbraco only (not on the content). Usually only the first time after hours/ next day of not being in the UI. Generally a page reload will make the error go away. Sometimes that doesn't work and need to restart the app by touching the web.config.

    I tried to build on a server with only 4.0 and get the error still.

    The v7 dlls are not in the bin folder.

    Any thoughts?
  • karen 186 posts 461 karma points
    May 12, 2015 @ 23:21
    karen
    0

    full error (just happened after probably session timeout)

     

    Server Error in '/' Application.


    Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

    Source Error: 

    Line 38: <body id="umbracoMainPageBody">
    Line 39:     <form id="Form1" method="post" runat="server" style="margin: 0px; padding: 0px">
    Line 40: <asp:ScriptManager runat="server" ID="umbracoScriptManager" ScriptMode="Release"> Line 41:         <CompositeScript ScriptMode="Release">
    Line 42:             <Scripts>


    Source File: e:\Web\Umbraco-WholeHealthRx\Umbraco\umbraco.aspx    Line: 40 

    Stack Trace: 

    [TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
       System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
       System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +180
       System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +192
       System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +115
       System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +426
       System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
       System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
       System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
       System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +399
       System.Web.UI.ScriptManager..ctor() +26
       ASP.umbraco_umbraco_aspx.__BuildControlumbracoScriptManager() in e:\Web\Umbraco-WholeHealthRx\Umbraco\umbraco.aspx:40
       ASP.umbraco_umbraco_aspx.__BuildControlForm1() in e:\Web\Umbraco-WholeHealthRx\Umbraco\umbraco.aspx:39
       ASP.umbraco_umbraco_aspx.__BuildControlTree(umbraco_umbraco_aspx __ctrl) in e:\Web\Umbraco-WholeHealthRx\Umbraco\umbraco.aspx:1
       ASP.umbraco_umbraco_aspx.FrameworkInitialize() in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2e279874\3829821a\App_Web_umbraco.aspx.5f2dec3.e9ughyf3.0.cs:0
       System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +54
       System.Web.UI.Page.ProcessRequest() +78
       System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
       System.Web.UI.Page.ProcessRequest(HttpContext context) +49
       ASP.umbraco_umbraco_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\2e279874\3829821a\App_Web_umbraco.aspx.5f2dec3.e9ughyf3.0.cs:0
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    



    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1031

  • Martin Lingstuyl 202 posts 379 karma points
    May 14, 2015 @ 22:06
    Martin Lingstuyl
    0

    Hi Karen,

    It's a bit of a long read this topic. But this is the gist of it: This error cannot be helped by not uploading the Umb 7 contour dll's.

    The point is the entire contour project has been compiled on a server running .net 4.5. in .net 4.5 some namespaces have moved to different places, including a few in mscorlib. You'll probably keep getting this error now and then when the application restarts.

    To circumvent the error you'll either have to downgrade contour to 3.0.17 (which is last version that doesn't have this problem) or you will have to switch to a .net 4.5 server.

    Good luck!

    Martin

  • karen 186 posts 461 karma points
    May 14, 2015 @ 22:38
    karen
    0

    HI Martin,

    Is there any chance to have a version of Contour that is compiled on .net 4 ?

    I cannot upgrade the server to 4.5, that is completely out of my control, and in a large company, such things take forever.

    I cannot downgrade to Contour 3.0.17 because I need the fix that is in place to allow file uploads to work correctly when using IE (which I believe is in latest contour version).

    Thanks,

    Karen

  • Martin Lingstuyl 202 posts 379 karma points
    May 15, 2015 @ 08:31
    Martin Lingstuyl
    0

    Hi Karen,

    Some of us in this topic asked the umbraco HQ to do that for us, but unfortunately they never did. Maybe it's impossible for them to do, as the projects are probably mixed together, and the v7 version cannot be compiled against 4.5.

    Anyway, there is no version that I know of that you can use.

    You can maybe try a way around. Revert to 3.0.17 and create your own Control/FieldType for contour. It's not that hard to do.

    For example, the code below is the standard FileUpload FieldType (don't know from which contour version, probably an older one) that receives the posted file and saves it. If you create your own control file (which works on IE) and refer to that instead of Core.Fileupload all you need to do is include the two files in an assembly and you're good to go.

    FileUpload Type:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Web;
    using System.Text.RegularExpressions;

    namespace Umbraco.Forms.Core.Providers.FieldTypes
    {
        public class FileUpload : FieldType
        {

            private Core.Controls.Fileupload fu;
            private List<Object> _value = new List<object>();

            public FileUpload()
            {
                this.Id = new Guid("84A17CF8-B711-46a6-9840-0E4A072AD000");
                this.Name = "File upload";
                this.Description = "Renders an upload field";

                this.Icon = "upload.png";
                this.DataType = FieldDataType.String;
                this.AssociatedField = new Field();
            }

           
            public override List<object> Values
            {
                get
                {
                    if (fu != null && fu.UploadControl.HasFile)
                    {
                        _value.Clear();
                        //string fileName = fu.UploadControl.FileName;
                        //string ext = fileName.Substring(fileName.LastIndexOf('.') + 1);
                        //fileName = Regex.Replace(fileName.Substring(0, fileName.LastIndexOf('.')), @"\W*", "").ToLower() + "." + ext;
                       
                        string dir = Configuration.Path + "/files/" + this.AssociatedField.Form.ToString() + "/" + Guid.NewGuid().ToString() + "/";

                        if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(dir)))
                            System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(dir));

                        fu.UploadControl.SaveAs(HttpContext.Current.Server.MapPath(dir + SafeUrl(fu.UploadControl.FileName)));

                        _value.Add(dir + SafeUrl(fu.UploadControl.FileName));
                    }

                    return _value;
                }
                set
                {
                    _value = value;
                }
            }

            private string SafeUrl(string url)
            {
                if (!String.IsNullOrEmpty(url))
                    return Regex.Replace(url, @"[^a-zA-Z0-9\-\.\/\:]{1}", "_");
                else
                    return String.Empty;
            }

            public override System.Web.UI.WebControls.WebControl Editor
            {
                get
                {
                    fu = new Umbraco.Forms.Core.Controls.Fileupload();
                    fu.ID = "fu" + this.Id;

                    if (_value.Count() > 0)
                        fu.FileName = _value[0].ToString();

                    return fu;
                }
                set
                {
                    base.Editor = value;
                }
            }

            public override string RenderPreview()
            {
                return "<input type='file'/>";
            }

            public override string RenderPreviewWithPrevalues(List<object> prevalues)
            {
                return RenderPreview();
            }

            public override List<object> ProcessValue(HttpContextBase httpContext)
            {
                List<Object> vals = new List<object>();

                //files
                bool filesaved = false;

                var files = httpContext.Request.Files;
                if (files.Count > 0 && files.AllKeys.Contains(this.AssociatedField.Id.ToString()))
                {
                    HttpPostedFileBase file = null;
                    file = files[this.AssociatedField.Id.ToString()];
                    if (file.ContentLength > 0)
                    {
                        string dir = Configuration.Path + "/files/" + Guid.NewGuid().ToString() + "/";
                        if (!System.IO.Directory.Exists(httpContext.Server.MapPath(dir)))
                            System.IO.Directory.CreateDirectory(httpContext.Server.MapPath(dir));
                        file.SaveAs(httpContext.Server.MapPath(dir + file.FileName));
                        vals.Add(dir + file.FileName);
                        filesaved = true;
                    }

                }

                if (!filesaved)
                {
                    vals.Add(httpContext.Request[this.AssociatedField.Id.ToString() + "_file"] ?? "");
                }

                return vals;
            }
        }
    }


    Instead of Core.Controls.Fileupload fu you would have to refer to a control class you yourself created.

    a control class might look like this (though this is just an alternative textbox control class that I created, one that has maxLength implemented. In the same way you could create a FileUpload class.

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace Contour.Addons.Controls
    {
        public class TextBoxAdvanced : TextBox
        {
            public string iMaxLength { get; set; }
            public override void RenderControl(HtmlTextWriter writer)
            {

                writer.Write("<div>");           
                base.RenderControl(writer);
                writer.Write("</div>");
            }

            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
                this.TextMode = TextBoxMode.SingleLine;

                if (iMaxLength != "")
                {
                    int MaxChars = 0;
                    int.TryParse(iMaxLength, out MaxChars);

                    if (MaxChars > 0)
                        this.MaxLength = MaxChars;
                }           

                this.CssClass = "text AdvBoxtxt ABT_" + GetID();
               
            }

            private string GetID()
            {
                return this.ClientID.Substring(this.ClientID.Length - 20, 20);
            }

            public string Value
            {
                get
                {
                    //if (this.Text == HttpContext.Current.Request[this.ClientID])
                    return this.Text;
                    //else
                    //return "";
                }
                set
                {
                    this.Text = value;
                }

            }

        }
    }

  • Martin Lingstuyl 202 posts 379 karma points
    May 15, 2015 @ 08:32
    Martin Lingstuyl
    0

    Hi Karen,

    Some of us in this topic asked the umbraco HQ to do that for us, but unfortunately they never did. Maybe it's impossible for them to do, as the projects are probably mixed together, and the v7 version cannot be compiled against 4.5.

    Anyway, there is no version that I know of that you can use.

    You can maybe try a way around. Revert to 3.0.17 and create your own FileUpload Control/FieldType for contour. It's not that hard to do.

    For example, the code below is the standard FileUpload FieldType (don't know from which contour version, probably an older one) that receives the posted file and saves it. If you create your own control file (which works on IE) and refer to that instead of Core.Fileupload all you need to do is include the two files in an assembly and you're good to go.

    FileUpload Type:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Web;
    using System.Text.RegularExpressions;

    namespace Umbraco.Forms.Core.Providers.FieldTypes
    {
        public class FileUpload : FieldType
        {

            private Core.Controls.Fileupload fu;
            private List<Object> _value = new List<object>();

            public FileUpload()
            {
                this.Id = new Guid("84A17CF8-B711-46a6-9840-0E4A072AD000");
                this.Name = "File upload";
                this.Description = "Renders an upload field";

                this.Icon = "upload.png";
                this.DataType = FieldDataType.String;
                this.AssociatedField = new Field();
            }

           
            public override List<object> Values
            {
                get
                {
                    if (fu != null && fu.UploadControl.HasFile)
                    {
                        _value.Clear();
                        //string fileName = fu.UploadControl.FileName;
                        //string ext = fileName.Substring(fileName.LastIndexOf('.') + 1);
                        //fileName = Regex.Replace(fileName.Substring(0, fileName.LastIndexOf('.')), @"\W*", "").ToLower() + "." + ext;
                       
                        string dir = Configuration.Path + "/files/" + this.AssociatedField.Form.ToString() + "/" + Guid.NewGuid().ToString() + "/";

                        if (!System.IO.Directory.Exists(HttpContext.Current.Server.MapPath(dir)))
                            System.IO.Directory.CreateDirectory(HttpContext.Current.Server.MapPath(dir));

                        fu.UploadControl.SaveAs(HttpContext.Current.Server.MapPath(dir + SafeUrl(fu.UploadControl.FileName)));

                        _value.Add(dir + SafeUrl(fu.UploadControl.FileName));
                    }

                    return _value;
                }
                set
                {
                    _value = value;
                }
            }

            private string SafeUrl(string url)
            {
                if (!String.IsNullOrEmpty(url))
                    return Regex.Replace(url, @"[^a-zA-Z0-9\-\.\/\:]{1}", "_");
                else
                    return String.Empty;
            }

            public override System.Web.UI.WebControls.WebControl Editor
            {
                get
                {
                    fu = new Umbraco.Forms.Core.Controls.Fileupload();
                    fu.ID = "fu" + this.Id;

                    if (_value.Count() > 0)
                        fu.FileName = _value[0].ToString();

                    return fu;
                }
                set
                {
                    base.Editor = value;
                }
            }

            public override string RenderPreview()
            {
                return "<input type='file'/>";
            }

            public override string RenderPreviewWithPrevalues(List<object> prevalues)
            {
                return RenderPreview();
            }

            public override List<object> ProcessValue(HttpContextBase httpContext)
            {
                List<Object> vals = new List<object>();

                //files
                bool filesaved = false;

                var files = httpContext.Request.Files;
                if (files.Count > 0 && files.AllKeys.Contains(this.AssociatedField.Id.ToString()))
                {
                    HttpPostedFileBase file = null;
                    file = files[this.AssociatedField.Id.ToString()];
                    if (file.ContentLength > 0)
                    {
                        string dir = Configuration.Path + "/files/" + Guid.NewGuid().ToString() + "/";
                        if (!System.IO.Directory.Exists(httpContext.Server.MapPath(dir)))
                            System.IO.Directory.CreateDirectory(httpContext.Server.MapPath(dir));
                        file.SaveAs(httpContext.Server.MapPath(dir + file.FileName));
                        vals.Add(dir + file.FileName);
                        filesaved = true;
                    }

                }

                if (!filesaved)
                {
                    vals.Add(httpContext.Request[this.AssociatedField.Id.ToString() + "_file"] ?? "");
                }

                return vals;
            }
        }
    }


    Instead of Core.Controls.Fileupload fu you would have to refer to a control class you yourself created.

    a control class might look like this (though this is just an alternative textbox control class that I created, one that has maxLength implemented. In the same way you could create a FileUpload class.

    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;

    namespace Contour.Addons.Controls
    {
        public class TextBoxAdvanced : TextBox
        {
            public string iMaxLength { get; set; }
            public override void RenderControl(HtmlTextWriter writer)
            {

                writer.Write("<div>");           
                base.RenderControl(writer);
                writer.Write("</div>");
            }

            protected override void OnInit(EventArgs e)
            {
                base.OnInit(e);
                this.TextMode = TextBoxMode.SingleLine;

                if (iMaxLength != "")
                {
                    int MaxChars = 0;
                    int.TryParse(iMaxLength, out MaxChars);

                    if (MaxChars > 0)
                        this.MaxLength = MaxChars;
                }           

                this.CssClass = "text AdvBoxtxt ABT_" + GetID();
               
            }

            private string GetID()
            {
                return this.ClientID.Substring(this.ClientID.Length - 20, 20);
            }

            public string Value
            {
                get
                {
                    //if (this.Text == HttpContext.Current.Request[this.ClientID])
                    return this.Text;
                    //else
                    //return "";
                }
                set
                {
                    this.Text = value;
                }

            }

        }
    }

  • karen 186 posts 461 karma points
    May 15, 2015 @ 15:21
    karen
    0

    HI Martin,

    Thanks for the help - I will try that - creating a new field type for Contour was next on my list of things to do/learn (when I get the time).

    I really appreciate your help!

    Thanks!

    Karen

Please Sign in or register to post replies

Write your reply to:

Draft