Copied to clipboard

Flag this post as spam?

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


  • Søren Eriksen-Aagreen 29 posts 76 karma points
    May 22, 2011 @ 12:37
    Søren Eriksen-Aagreen
    0

    problem creating new document with uTube datatype programmatically

    Hi All,

    When trying to create a new document with the uTube datatype, from either xslt, or a usercontrol, the creation fails with:

    -- 

    Object reference not set to an instance of an object.

    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.NullReferenceException: Object reference not set to an instance of an object.

    --

    This is using something like this: 

    Document uTubeDocument = Document.MakeNew("New uTube document", DocumentType.GetByAlias("uTubeVideo"), new User(0), parentId);

    And before assigning any value to the uTube property - changing the uTube datatype to a textbox makes the creation of the document go through. 

    /Søren

     


     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 22, 2011 @ 15:43
    Lee Kelleher
    0

    Hi Søren,

    Which uTube data-type are you using? (Is it the Single Video Picker?)

    Could you post the rest of the exception's stack-trace, we might be able to pinpoint the issue.

    Thanks, Lee.

  • Søren Eriksen-Aagreen 29 posts 76 karma points
    May 22, 2011 @ 16:34
    Søren Eriksen-Aagreen
    0

    Hi Lee,

     

    Thank you for the reply.

     

    Yes, I'm using the single picker, and the stacktrace is:

     

    umbracoXsltExtension   Extension added: urn:uTube.XSLT, Library 0,11929141832272 0,000021
    umbracoMacro After adding extensions 0,119311253245873 0,000020
    umbracoMacro Before performing transformation 0,122131444080183 0,002820
    umbracoMacro InnerException An error occurred during a call to extension function 'CreateCompetitionEntry'. See InnerException for a complete description of the error.
    An error occurred during a call to extension function 'CreateCompetitionEntry'. See InnerException for a complete description of the error.
      at System.Xml.Xsl.Runtime.XmlExtensionFunction.Invoke(Object extObj, Object[] args)
      at System.Xml.Xsl.Runtime.XmlQueryContext.InvokeXsltLateBoundFunction(String name, String namespaceUri, IList`1[] args)
      at System.Xml.Xsl.CompiledQuery.Query.<xsl:template match="/">(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator {urn:schemas-microsoft-com:xslt-debug}current, Double {urn:schemas-microsoft-com:xslt-debug}position, Double {urn:schemas-microsoft-com:xslt-debug}last, IList`1 {urn:schemas-microsoft-com:xslt-debug}namespaces) in D:\\public\xslt\YouTubeFormular.xslt:line 104
      at System.Xml.Xsl.CompiledQuery.Query.<xsl:apply-templates>(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime, XPathNavigator , Double , Double )
      at System.Xml.Xsl.CompiledQuery.Query.Root(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
      at System.Xml.Xsl.CompiledQuery.Query.Execute(XmlQueryRuntime {urn:schemas-microsoft-com:xslt-debug}runtime)
      at System.Xml.Xsl.XmlILCommand.Execute(Object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter writer)
      at System.Xml.Xsl.XslCompiledTransform.Transform(IXPathNavigable input, XsltArgumentList arguments, TextWriter results)
      at umbraco.macro.GetXsltTransformResult(XmlDocument macroXML, XslCompiledTransform xslt, Dictionary`2 parameters)
      at umbraco.macro.loadMacroXSLT(macro macro, MacroModel model, Hashtable pageElements) 0,413368179475324 0,291237
    umbracoMacro InnerException Object reference not set to an instance of an object.
    Object reference not set to an instance of an object.
      at project.XsltExtensions.CreateCompetitionEntry(String name, String address, String zipcode, String city, String email, String telephone, String youtubeUrl) 0,415350274965114 0,001982

     

     I switched to using the following, with the input coming from a regular textbox

     

    <xsl:variable name="youtubeVideoId" select="uTube.XSLT:GetVideoId($currentPage/youtubeVideoUrl)"/>
     <xsl:value-of select="uTube.XSLT:GetYouTubeEmbedCode($youtubeVideoId, 400, 500)" disable-output-escaping="yes"/>

     

    so the package is still extremely useful, but it would be great if the other approach could be accomplished :)

     

    /Søren

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 22, 2011 @ 22:06
    Lee Kelleher
    0

    Hi Søren,

    Not sure what else is going on in your "CreateCompetitionEntry" method, does the error occur when you call "Document.MakeNew" or elsewhere?

    I've taken a look over the uTube codebase to see where there might be an issue, but I don't see any problems with the code.

    Hmmm... not sure what to suggest.

    Cheers, Lee.

  • Søren Eriksen-Aagreen 29 posts 76 karma points
    May 22, 2011 @ 23:38
    Søren Eriksen-Aagreen
    0

    Hi Lee,

    Yes, only thing going on in the method is 

    Document uTubeDocument = Document.MakeNew("New uTube document", DocumentType.GetByAlias("uTubeVideo"), new User(0), parentId);

    (the rest is outcommented for testing this issue.)

    /Søren

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    May 26, 2011 @ 12:22
    Lee Kelleher
    0

    Hi Søren,

    This is still puzzling me.  To my knowledge, Document.MakeNew doesn't do anything with the properties/data-type ... it just creates a the document stub (with empty/null properties).

    What happens when you call "DocumentType.GetByAlias" on it's own?

    Cheers, Lee.

  • Søren Eriksen-Aagreen 29 posts 76 karma points
    May 29, 2011 @ 13:34
    Søren Eriksen-Aagreen
    0

    Hi Lee,

    Yeah, it puzzles me to, but it works when I change the datatype to a textstring from the single picker, so it seems to be connected to that somehow - you are not able to reproduce ?

    /Søren

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jun 02, 2011 @ 17:03
    Lee Kelleher
    0

    Hi Søren,

    Sorry for taking a while to get back to you - I've only just had chance to try to reproducing this problem.

    In my test it works fine for me; creates the new document with no errors/exceptions.  My doc-type only contained a few textstring properties and one "uTube Single Video Picker" property. Which worked fine.

    Not sure what to suggest next.

    - Lee

  • Søren Eriksen-Aagreen 29 posts 76 karma points
    Jun 08, 2011 @ 22:16
    Søren Eriksen-Aagreen
    0

    Seems my post dissappeared... Anyways here it is somewhat reconstructed :)

    Thanks for taking the time to respond. Could it somehow be an issue that I'm using MySql ?

    /Søren

     

     

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Jun 08, 2011 @ 23:57
    Lee Kelleher
    0

    Hi Søren,

    Ah, I haven't tested against using MySQL ... must take a look at that sometime - still curious what the problem could be? I'm not doing anything 'out of the ordinary' with the uTube data-type (uses standard Umbraco API).

    Cheers, Lee.

Please Sign in or register to post replies

Write your reply to:

Draft