Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"System.MissingMethodException" when using Html.ConvertImgToSrcSet #24

Closed
dhymik opened this issue Apr 6, 2020 · 6 comments
Closed

Comments

@dhymik
Copy link

dhymik commented Apr 6, 2020

This is on Umbraco 8.6

On my DocType ContentPage, I have a RichText property editor with alias RichTextTest. When I do this in a view:

@Html.ConvertImgToSrcSet(Model, ContentPage.GetModelPropertyType(m => m.RichTextTest).Alias)

then I get a System.MissingMethodException. I get the exception whether there are images in the RTE or not.

I can use Slimsy's other methods like GetCropUrl and GetSrcSetUrls without trouble.

My Image media type has the Upload property set to Image Cropper.

Any idea what I am doing wrong? Is this a bug or user error?

On Our, David Peck suggested it might be related to the constructor having been removed (see here) in Umbraco. However, it could also be related to me doing something wrong which would cause the code to try and call the wrong constructor. The strange thing is, I remember using ConvertImgToSrcSet in a somewhat similar scenario and it worked back then.

Here is the complete error trace:

[MissingMethodException: Method not found: 'Void Umbraco.Web.PropertyEditors.ValueConverters.RteMacroRenderingValueConverter..ctor(Umbraco.Web.IUmbracoContextAccessor, Umbraco.Web.Macros.IMacroRenderer)'.]
   Slimsy.Slimsy.ConvertImgToSrcSet(HtmlHelper htmlHelper, String sourceValueHtml, Boolean generateLqip, Boolean removeStyleAttribute) +0  
   Slimsy.Slimsy.ConvertImgToSrcSet(HtmlHelper htmlHelper, IPublishedContent publishedContent, String propertyAlias, Boolean generateLqip, Boolean removeStyleAttribute) +58
   ASP._Page_Views_ContentPage_cshtml.Execute() in C:\Users\Mikael\source\U8_1\Web\Views\ContentPage.cshtml:27
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +198
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +105
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +78
   System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +235
   System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
   Umbraco.Web.Mvc.ProfilingView.Render(ViewContext viewContext, TextWriter writer) in D:\a\1\s\src\Umbraco.Web\Mvc\ProfilingView.cs:25
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +56
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +420
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +52
   System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__4() +198
   System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +100
   System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
   System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +11
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +45
   System.Web.Mvc.<>c.<BeginExecute>b__151_2(IAsyncResult asyncResult, Controller controller) +13
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
   System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
   System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +28
   System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
   System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +577
   System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +132
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163
@Jeavon
Copy link
Owner

Jeavon commented Apr 8, 2020

Hmm, I'll take a look, thanks for reporting

@Jeavon
Copy link
Owner

Jeavon commented Apr 8, 2020

The method has totally changed - I have updated the code accordingly. If you have time the fix is available in beta4-0000222 https://www.myget.org/feed/umbraco-packages/package/nuget/Our.Umbraco.Slimsy/3.0.0-beta4-000222

I'll do some additional testing then release this as beta4

@dhymik
Copy link
Author

dhymik commented Apr 8, 2020

I installed the fix but the slimsy.dll is missing. Can't reference Slimsy with this beta4.

@Jeavon
Copy link
Owner

Jeavon commented Apr 9, 2020

Oh, that's strange, I downloaded the nupkg and it seems to be in there

@dhymik
Copy link
Author

dhymik commented Apr 9, 2020

3.0.0-beta4-000228 from MyGet works now as expected. Thank you for the quick fix!

@Jeavon
Copy link
Owner

Jeavon commented Apr 9, 2020

I have released beta4 to NuGet, many thanks for reporting!

@Jeavon Jeavon closed this as completed Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants