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

Failing tests with .NET 4.8 #145

Closed
NN--- opened this issue Jul 11, 2020 · 3 comments
Closed

Failing tests with .NET 4.8 #145

NN--- opened this issue Jul 11, 2020 · 3 comments

Comments

@NN---
Copy link
Contributor

NN--- commented Jul 11, 2020

System.NullReferenceException : Object reference not set to an instance of an object.
   at Vanara.InteropServices.IntPtrConverter.Convert(IntPtr ptr, UInt32 sz, Type destType, CharSet charSet) in Vanara\Core\InteropServices\IntPtrConverter.cs:line 46
   at Vanara.PInvoke.Collections.UntypedNativeMemoryEnumerator.get_Current() in Vanara\Core\Collections\NativeMemoryEnumerator.cs:line 90
   at Vanara.PInvoke.Collections.NativeMemoryEnumerator`1.get_Current() in Vanara\Core\Collections\NativeMemoryEnumerator.cs:line 25
   at Vanara.Extensions.Tests.InteropExtensionsTests.ToIEnumTest() in Vanara\UnitTests\Core\Extensions\InteropExtensionsTests.cs:line 203

System.NullReferenceException : Object reference not set to an instance of an object.
   at Vanara.InteropServices.IntPtrConverter.Convert(IntPtr ptr, UInt32 sz, Type destType, CharSet charSet) in Vanara\Core\InteropServices\IntPtrConverter.cs:line 46
   at Vanara.PInvoke.Collections.UntypedNativeMemoryEnumerator.get_Current() in Vanara\Core\Collections\NativeMemoryEnumerator.cs:line 90
   at Vanara.PInvoke.Collections.NativeMemoryEnumerator`1.get_Current() in Vanara\Core\Collections\NativeMemoryEnumerator.cs:line 25
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Vanara.Extensions.Tests.InteropExtensionsTests.MarshalToPtrTest3() in Vanara\UnitTests\Core\Extensions\InteropExtensionsTests.cs:line 147
@ljani
Copy link

ljani commented Jul 11, 2020

I'm on .NET Core 3.1.301 and for example EnumServicesStatusEx returns fails with System.NullReferenceException as well.

@dahall
Copy link
Owner

dahall commented Jul 11, 2020

@NN--- : I have fixed these (see notes on commits)
@ljani : What parameters are causing that error?

@ljani
Copy link

ljani commented Jul 13, 2020

Both EnumServicesStatusEx(manager, AdvApi32.ServiceTypes.SERVICE_WIN32, AdvApi32.SERVICE_STATE.SERVICE_STATE_ALL) and EnumServicesStatusEx(manager, AdvApi32.ServiceTypes.SERVICE_TYPE_ALL, AdvApi32.SERVICE_STATE.SERVICE_STATE_ALL) fail.

Copy pasting the code and changing mem.ToEnumerable<ENUM_SERVICE_STATUS_PROCESS> to mem.ToArray<ENUM_SERVICE_STATUS_PROCESS> fixes the issue for me.

dahall added a commit that referenced this issue Jul 13, 2020
@dahall dahall closed this as completed Jul 13, 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

3 participants