"Nullable must be unwrapped" when adding PictureBox Windows Forms control

winforms

(John Perez) #1

When adding System.Windows.Forms.PictureBox to a Silver Winforms app, the following error occurs upon a build:

(E484) Cannot access members on wrapped nullable type “System.ComponentModel.ISupportInitialize?”

on the following lines in Main.Designer.Swift:

(self.pictureBox1 as? System.ComponentModel.ISupportInitialize).BeginInit()
(self.pictureBox1 as? System.ComponentModel.ISupportInitialize).EndInit()

In the code editor the tip “Nullable must be unwrapped” appears beside the lines above.


(marc hoffman) #2

Sounds like a codegen bug. since

(self.pictureBox1 as? System.ComponentModel.ISupportInitialize)

is a nullable, this needs

(self.pictureBox1 as? System.ComponentModel.ISupportInitialize)?.BeginInit(),

of course. Will log.


(RemObjects) #3

Thanks, logged as bugs://80627


(RemObjects) #4

bugs://80627 got closed with status fixed.


(John Perez) #5

I am not using a build that has this bug fixed yet, but I just want to add that the same issue happens with a SplitContainer… not sure if that (and other controls) gets fixed for this issue as well.


(marc hoffman) #6

Probably the same issue.

.2311 has the fix; it’s building now and should be out later today.


(John Perez) #7

Can you send the 10.0.2311 build to my account, username “jbperez808”

Thanks!


(marc hoffman) #8

Sure thing!