adafruit / adafruit/AdafruitClassLibrary

Value cannot be null.:I2C Write Exception: {0}

Open
#6 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
24
Forks
10
PR merge metrics
No merged PRs in 30d

Description

When attempting to use the nuget packages PCA9685 class I was getting the following error logged after calling `SetAllPWM()`.

**Value cannot be null.:I2C Write Exception:**

Instead of the nuget package I pulled the latest source down from here. The null reference exception was coming from Device being null. At first I thought it wasn't being set correctly in InitI2CAsync, but then found that InitPCA9685Async was also throwing and logging an exception. With the exceptions being logged and then ignored it's difficult to go straight to the cause of the problem.

Then underlying error was:

**Could not load file or assembly 'System.Runtime.WindowsRuntime,...**

Found the [solution](https://github.com/KSemenenko/ColorThief/issues/3#issuecomment-251656380):

> the default NuGet package (Microsoft.NETCore.UniversalWindowsPlatform) had to be upgraded to the latest version (5.2.2) as well!

Once I updated UWP to 5.2.3 it started working.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the PCA9685 failure through SetAllPWM(), then trace InitI2CAsync and InitPCA9685Async to see where the underlying assembly-loading exception is lost. Check the NuGet package configuration for Microsoft.NETCore.UniversalWindowsPlatform and verify that the reported dependency version resolves the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, raspberry-pi
Domain
embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.