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

Hardware Station extension with IController fails to ping #91

Closed
rphillipsnwt opened this issue Jan 4, 2022 · 5 comments
Closed

Hardware Station extension with IController fails to ping #91

rphillipsnwt opened this issue Jan 4, 2022 · 5 comments
Assignees

Comments

@rphillipsnwt
Copy link

rphillipsnwt commented Jan 4, 2022

Adding a custom device, IController, to the HWS sample causes the installed HWS to no longer ping.

The vanilla HWS sample works fine. As soon as I add to or replace the payment device, INamedRequestHandler, with a custom device and redeploy the ping fails. I have tried several permutations with the payment device and custom device, but always as soon as I reference the custom device in the extensions config the ping fails.

I am building my extension using the release/9.33 branch and installing over the base "10.0.23 - Hardware Station (SEALED)" package that was created in LCS on 12/17/2021.


Basic custom device

namespace Contoso.HardwareStation.Peripherals.PaymentDevice {
    using Microsoft.Dynamics.Commerce.Runtime.Hosting.Contracts;
    using System.Threading.Tasks;

    [RoutePrefix("TESTDEVICE")]
    public class TestDeviceController : IController {
        [HttpPost]
        public Task<bool> TestOne(IEndpointContext context) {
            return Task.FromResult(true);
        }
    }
}

Event viewer warning

Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 1/4/2022 1:45:28 PM 
Event time (UTC): 1/4/2022 9:45:28 PM 
Event ID: 39fb4d1cc40b4bcc99463e5e5e3fa876 
Event sequence: 2 
Event occurrence: 1 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/7/ROOT/HardwareStation-6-132858063283888627 
    Trust level: Full 
    Application Virtual Path: /HardwareStation 
    Application Path: C:\Program Files\Microsoft Dynamics 365\10.0\Commerce hardware station\Microsoft\Webroot\ 
    Machine name: MININT-FN7JP81 
 
Process information: 
    Process ID: 3508 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\RetailHardwareStationAppPool 
 
Exception information: 
    Exception type: TargetInvocationException 
    Exception message: Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Owin.Loader.DefaultLoader.<>c__DisplayClass19_1.<MakeDelegate>b__0(IAppBuilder builder)
   at Owin.Loader.DefaultLoader.<>c__DisplayClass9_0.<LoadImplementation>b__0(IAppBuilder builder)
   at Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup)
   at Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup)
   at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint()
   at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
   at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context)
   at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
   at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
   at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)

Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
   at Microsoft.Dynamics.Commerce.Runtime.Hosting.Framework.AdapterFactory.GenerateControllerAdapter(ControllerMetadataBase controllerMetadata, IEnumerable`1 derivedControllerMetadataTypes, XslCompiledTransform adapterTemplate, IEnumerable`1 templateDependencies, Stream outputStream)
   at Microsoft.Dynamics.Commerce.Runtime.Hosting.Framework.AdapterFactory.GenerateControllerAdapter(ControllerMetadataBase controllerMetadata, IEnumerable`1 derivedControllerMetadataTypes, XslCompiledTransform adapterTemplate, IEnumerable`1 templateDependencies)
   at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
   at Microsoft.Dynamics.Commerce.HardwareStation.HardwareStationRuntime.AddExtensionAssembliesToComposition(IEnumerable`1 extensionAssemblyList)
   at Microsoft.Dynamics.Commerce.HardwareStation.WebApi.WebApiConfig.Register(HttpConfiguration config, IRetailServerService retailServerService, ISecureStorageProvider pairingKeyStorageProvider, ISecureStorageProvider merchantInfoStorageProvider, ISecureStorageProvider applicationDataStorageProvider)
   at Microsoft.Dynamics.Commerce.HardwareStation.StartupBase.Configuration(IAppBuilder app)

 
 
Request information: 
    Request URL: https://minint-fn7jp81:16432/HardwareStation/Ping 
    Request path: /HardwareStation/Ping 
    User host address: 192.168.123.63 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: IIS APPPOOL\RetailHardwareStationAppPool 
 
Thread information: 
    Thread ID: 63 
    Thread account name: IIS APPPOOL\RetailHardwareStationAppPool 
    Is impersonating: False 
    Stack trace:    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Owin.Loader.DefaultLoader.<>c__DisplayClass19_1.<MakeDelegate>b__0(IAppBuilder builder)
   at Owin.Loader.DefaultLoader.<>c__DisplayClass9_0.<LoadImplementation>b__0(IAppBuilder builder)
   at Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup)
   at Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup)
   at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint()
   at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory)
   at Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context)
   at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
   at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
   at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
   at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
 
 
Custom event details: 

@Pikhulya
Copy link

Pikhulya commented Jan 6, 2022

Seems like the assembly Microsoft.CodeAnalysis could not be loaded, can you check if it is present in the Hardware Station's web site and if so what exactly version of the assembly is deployed in your environment?

If the assembly is not there - can you manually place it there and see if the issue will go away?

@rphillipsnwt
Copy link
Author

rphillipsnwt commented Jan 7, 2022

Yes, that worked.

Am I doing something wrong with my extension, or is this something that needs to be addressed on Microsoft's side in the sealed HWS? I will assume for the time being that integrators will, at least for the time being, need to manually copy these files.


I am working on a OneBox VM downloaded from LCS and after copying both...

C:\RetailSDK\References\microsoft.codeanalysis.common\3.3.0\lib\netstandard2.0\Microsoft.CodeAnalysis.dll
C:\RetailSDK\References\microsoft.codeanalysis.csharp\3.3.0\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.dll

...to the sealed HWS' ...\Webroot\bin directory I was able to ping with a custom device extension installed and referenced. I was also able to copy from the .NET Framework directory and successfully ping the HWS.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\bbf8da49\6436c7ce\assembly\dl3\83597c99\0065c2b0_49b9d701\Microsoft.CodeAnalysis.DLL
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\bbf8da49\6436c7ce\assembly\dl3\cc757dfc\0065c2b0_49b9d701\Microsoft.CodeAnalysis.CSharp.DLL

I also tried adding CodeAnalysis to my HWS extension project via nuget, and then removed it. Using the downloaded files also worked.

(...user directory...).nuget\packages\microsoft.codeanalysis.common\3.3.1\lib\netstandard2.0\Microsoft.CodeAnalysis.dll
(...user directory...).nuget\packages\microsoft.codeanalysis.csharp\3.3.1\lib\netstandard2.0\Microsoft.CodeAnalysis.CSharp.dll

@Pikhulya
Copy link

>... Am I doing something wrong with my extension, or is this something that needs to be addressed on Microsoft's side in the sealed HWS? ...

@rphillips-newestech that is the bug, while it is still not fixed please keep copying the DLLs manually.

@lukedgr
Copy link
Member

lukedgr commented Feb 28, 2022

Hi, thank you for reporting this issue. We have fixed the issue in hardware station build 9.35.22042.19. Please uptake that version or later to apply the fix.

@lukedgr lukedgr self-assigned this Feb 28, 2022
@lukedgr lukedgr closed this as completed Feb 28, 2022
@rphillipsnwt
Copy link
Author

Thank you!

@madyke madyke transferred this issue from microsoft/Dynamics365Commerce.InStore May 22, 2023
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

3 participants