episerver / netcore-preview

This repository is a preview providing early access to the latest Optimizely (formerly Episerver) product packages targeting .NET 5.
43 stars 9 forks source link

Commerce: Creating a Shipping Plugin fails generating class name list #109

Closed stefanolsen closed 3 years ago

stefanolsen commented 3 years ago

Observations: When attempting to use the "Create Shipping Provider" page in Episerver Commerce, the drop-down list, "Class Name", is empty.

It looks like the Admin UI sends a request to /EPiServer/EPiServer.Commerce.UI.Admin/ShippingProviders/GetClassNames. The response on this URL consists of a stack trace like the following:

Could not load type 'System.Runtime.Remoting.Proxies.RealProxy' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Linq.Enumerable.SelectManySingleSelectorIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
   at EPiServer.Commerce.UI.Admin.Shipping.Internal.ShippingService.GetClassNames()

Expected: Instead of an exception, a list of shipping plugin class names should be returned, making the Episerver UI work properly.

Builds:

stefanolsen commented 3 years ago

It looks like /EPiServer/EPiServer.Commerce.UI.Admin/Payment/GetClassNames works. And the main difference is the way you scan the assemblies for relevant types.

Probably easiest to change this to use the same scanning method as you use for payment class names.

lunchin commented 3 years ago

Fixed in 14.0.2-pre-021291