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

CustomCapability: LoadPackagedLibrary() can not load RpcClient.dll #907

Closed
huntercao opened this issue Jun 8, 2018 · 2 comments
Closed

Comments

@huntercao
Copy link

huntercao commented Jun 8, 2018

CustomCapability: LoadPackagedLibrary will cause exception.
Build with VS2017 + Windows SDK 17134.

The exception details are below:

System.DllNotFoundException
  HResult=0x80131524
  Message=Unable to load DLL 'api-ms-win-core-libraryloader-l2-1.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
  Source=CustomCapability
  StackTrace:
   at SDKTemplate.ServiceViewModel.LoadPackagedLibrary(String filename, UInt32 reserved)
   at SDKTemplate.ServiceViewModel.<>c.<.ctor>b__58_0() in C:\windows_samples\win10_audio\uwp\CustomCapability\cs\ServiceViewModel.cs:line 90
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at SDKTemplate.ServiceViewModel.<>c__DisplayClass59_0.<StartMetering>b__0() in C:\windows_samples\win10_audio\uwp\CustomCapability\cs\ServiceViewModel.cs:line 212
   at System.Threading.Tasks.Task.Execute()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at SDKTemplate.ServiceViewModel.<StartMetering>d__59.MoveNext() in C:\windows_samples\win10_audio\uwp\CustomCapability\cs\ServiceViewModel.cs:line 203
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at SDKTemplate.MeteringData.<button_Click_StartMetering>d__2.MoveNext() in C:\windows_samples\win10_audio\uwp\CustomCapability\cs\Scenario1_MeteringData.xaml.cs:line 24

When we modify the dll name to api-ms-win-core-libraryloader-l2-1-0.dll, the LoadPackagedLibrary() will always return 0 while the RpcClient.dll is in the working folder.
As introduced in this page: https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis

API Requirements
LoadPackagedLibrary Introduced into api-ms-win-core-libraryloader-l2-1-0.dll in 10.0.10240.
@oldnewthing
Copy link
Member

Duh. I messed up the API set, and I forgot to say CharSet.Unicode. Fix coming.

@oldnewthing
Copy link
Member

Fixed in v6.0.5.

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