Fix for error “… contents of array parameters must be either readable or writable. Please apply either System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute or System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute to …”

13 September 2015 Leave a comment

Hopefully this might save someone else a little searching. Recently doing some work on C# code to run a NRF24L01+ on a Raspberry Pi 2 when I got this error:

In the Windows Runtime, the contents of array parameters must be either readable or writable. Please apply either System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute or System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute to ‘address’.

this MSDN help here on the ReadOnlyAttributeClass wasn’t all too helpful, similarly the MSDN help here for the WriteOnlyAttributeClass didn’t offer a lot of advice on what this looked like.

Fortunately this MSDN link explained clearly how ReadOnlyAttributeClass or WriteOnlyAttributeClass should be used:

In my case

    public void Configure(byte[] address, byte channel)

became:

   public void Configure([ReadOnlyArray] byte[] address, byte channel)

and all was well again. At least until I got to the next bug.

(Rant) – Shame @FTDIChip for bricking my #Arduino programmer

12 September 2015 1 comment
'FTDI' 232 programmer
my ‘FTDI’ programmer, that isn’t an FTDI, and now thanks to FTDI is not a programmer any longer either!

A year or two ago I bought an FTDI based programmer with what appeared to be a FTDI232  chip, to program my Arduino Pro Mini.

Then (and until today) I never knew there were fake FTDI chips. It just isn’t the sort of thing you do, go over every PCB you buy and what, break out the electron microscope. Seriously, why would I have any reason to suspect fake chips like this even existed.

The “FTDI232” programmer looked like a programmer, the chip had a logo that appeared to be FTDI (as if I really cared, then), I thought – end of story.

Until today FTDI as a company didn’t mean anything special to me – good, bad or indifferent, and as far as I knew FTDI was just another chip company.

FTDI232 programmer, circuit board side

FTDI232 programmer, circuit board side

Enter the flu season (here in Australia), feeling rubbish I figured I’d dust off a couple of Arduinos and potter around with a back burner project.

Had a few problems reprogramming my Pro Mini, with a COM port in use error, and having done a Windows 10 upgrade recently thought I’d at least update the FTDI drivers to eliminate this possibility.

On FTDI’s website I downloaded the latest driver (Windows x64  v 2.12.06) but soon found my problems got much worse.

The programmer failed, still but after some further examination I found the Arduino serial port monitor just says “NON GENUINE DEVICE FOUND!” and my programmer is not longer a programmer.

My 'FTDI' programmer is no more - it is a brick
y ‘FTDI’ programmer is no more, now bricked

I did a search and only then found that FTDI don’t so much as “bite the hand that feeds them”, rather they bite off the hand of those who don’t feed them!

There is a hint at this in the fine print, on another page, but then who actually reads the fine print?

Would you take the following phrase in the FTDI fine print seriously?

This is what it says:

” Use of the Software as a driver for a component that is not a Genuine FTDI Component MAY IRRETRIEVABLY DAMAGE THAT COMPONENT. “

and then further

“It is your responsibility to make sure that all chips you use the Software as a driver for are Genuine FTDI Components. If in doubt then contact FTDI.”

Many companies use FUD – Fear Uncertainty Doubt – in their marketing strategy, such as “buy genuine XYZ brand oil filters or your car will (might) die”. Few actually damage components with no warning during installation or warning before actual use.

Why on earth would FTDI choose to brick fake chips instead of say chasing down the fake chip manufacturers? Or choose bricking instead of confronting the makers of the boards who buy these fake chips – goodness, what a marketing opportunity – “why not buy our ‘non-fake’ chips and we won’t sue you.  No, instead it seems FDI decided to penalise the innocent public and upset potential customers.

Did FTDI created a market for fakes by outlandish prices? Who knows. Was a manager at FTDI trying to get the chips in the stores by Christmas, cut corners, save costs, go limp on protection? And while I don’t think faking chips is excusable in any way – fake chips are stealing someone’s proprietary know-how and that is wrong, very wrong, but why do I now feel violated, simply by installing FTDI drivers and having these brick my programmer?

So where now?

I thought I was an FTDI customer, found out I am not, but now know I will never (wittingly) become one. So thanks FTDI, your marketing people are so good but they have been working for the competition – I would rather have ANY other chip of any other brand than another FTDI anything.

Then there is the trust aspect, how could I trust FTDI in the future when they have demonstrated what they can do, to reach into their chips (or others, fakes) and do this? There is definitely something creepy in this, and I do not wish to risk any back-doors being installed as could well be here, nor do I wish to support such a brutal, thoughtless, inconsiderate company.

There are so many other honourable and potentially customer retaining avenues that would have been better. For example why not:

(1) FTDI drivers check the chip on install, issue a warning, and simply do nothing! I could have at least returned the programmer to the company I bought it from (a bit hard when it is now broken), and instead get a real FTDI based board and could still like FTDI and FTDI products.

or

(2) FTDI drivers check during install for fakes and tell the user, then offer the user a license fee paid to FTDI. You could make the drivers a little less desirable than the regular FDI drivers to a regular FTDI chip, but again you’d keep potential customers and make some money from the fakes.

As it is, I cannot think of anything nice to say about FTDI except perhaps thanks for nothing, or thank you for helping me choose what is not the chip in my next programmer.

Categories: Arduino, IOT, programming Tags: ,

Fix to make Server 2012 R2 Essentials Connector compatible with Windows 10 – backups are back!

07 August 2015 1 comment

Backups – from manual to Windows Home Server to Windows Server Essentials

After 2 lightning strikes and occasional HDD crashes I’ve really valued regular backups first hand, but have also realised the need to automate backups as it is all too easy to forget, get lazy and get caught out if left to chance.

Enter Windows Home Server – probably the best product no-one ever knew about.

I guess it was hard for the larger market of everyday people to understand and yet this was a real life saver. Ideal for the small 1-5 or even up to 10-man business, it just worked and worked well. Simple, inexpensive but unknown it fizzled away but had been having a problem keeping up with newer versions of Windows. Eventually Home Server was ‘replaced’ by a cut down Windows Server called Server Essentials. Still overkill for home or small business, but it came with a new issue – your PCs need to join a domain. Having no workgroup option meant some editions of windows, or the desire for a simple easy home dev network all just more complicated.

Then someone came up with a hack/workaround to allow your PC to stay in a workgroup and still connect using the Server 2012 R2 server connector. (details below)

Enter Windows 10 and it seem like Groundhog Day. The story got repeated. backups fell off again, initially the excuse given was Windows 10 Internal Preview or Tech Preview were not production OS’s.

When the final version Windows 10 upgrade compatibility report said my system (with the connector) was compatible I found the connector didn’t work, the report lied and trying compatibility settings didn’t help. Early reports were that the connector would not be available until at least September/October 2015.

compatibility report

Attempts to run the connector gave the error:
“An unexpected error has occurred. To resolve this issue, contact the person responsible for your network.”

connector issues

Workaround / fix:

This evening I stumbled across a patch linked from a forum post last year here that has Windows 10 updates!

http://www.microsoft.com/en-ie/download/details.aspx?id=40285&44F86079-8679-400C-BFF2-9CA5F2BCBDFC=1

I used the patch Windows10.0-KB2790621-x64.msu was dated 29/07/2015 with my Windows 10 x64 Enterprise desktop (running in a workgroup).

Run the patch then navigate to your Server 2012 R2 Server, download the connector but do not run yet.

Go to your download folder, in Windows Explorer, right click and change the properties to run in Compatibility Mode as if under Windows 8 (you can use the long winded trouble shooter, or just the properties as below).

compatibility mode

Follow the rest of the prompts, then if you want to not need to join a domain, and stay in a workgroup as well, then do these steps

(start of Windows Server 2012 R2 hack to avoid having to join a domain)

This useful hack/patch will allow you to leave your workstation in a workgroup and yet still use the connector:

http://homeservershow.com/forums/index.php?/topic/6334-server-2012-r2-essentials-skip-domain-join/

just prior to entering in your username and password, open up a admin windows console (Windows + X, A) then type in:

reg add "HKLM\SOFTWARE\Microsoft\Windows Server\ClientDeployment" /v SkipDomainJoin /t REG_DWORD /d 1

then open up regedit, go to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Server\Networking\ServerDiscovery
then open the string “SkipAutoDNSServerDetection” and change the value from True to False

(end of Windows Server 2012 R2 hack to avoid having to join a domain)

Now get back to the connector install window, enter in your server username and password and follow the rest of the prompts and voila, you have been connected!

connected to server

The new blue screen? Windows 10 Setup error “Something Happened”

Have to laugh, thought I’d try the new Windows 10 media creation tool, picked the option to do an upgrade (as opposed to prepare media for another PC) and got this:

"Something Happened"

“Something Happened”

<sigh>

sorry to those who worked hard on Windows 10, I suppose this is a little like living in a glass house and throwing stones, but it does look nice – a new shade of blue and it doesn’t fill the whole screen (more later)…

Categories: programming

Fix for Raspberry Pi 2 install Windows 10 Error 87 – and (bonus) how to setup your SD card using Windows 8.1

thanks Carl & Richard listened to DotNetRocks – episode 1143 at work yesterday, found Windows 10 IOT was out (been waiting 2 months, missed seeing emails from Microsoft <sigh>) Raced home to try it, found according to both Microsoft’s IOT site here and Scott Hanselman’s great guide here I needed Windows 10 on my PC to install Windows 10 IOT on the SD card for my Raspberry Pi 2.

Impatient I tried dism.exe directly from Windows 8.1 but (surprise) I got an error:

Deployment Image Servicing and Management tool
Version: 6.3.9600.17031
Error: 87
The /applydrive option is not recognized in this context.
For more information, refer to the help.
The DISM log file can be found at C:\Windows\Logs\DISM\dism.log

error 87 effectively means that dism version 6.3.9600.17031 from Windows 8.1 is now superseded; the new Windows 10 version, ver # 10.0.10074.0 is smarter-er, knows what the new /applydrive switch is supposed to do🙂

Windows 8.1 users should still probably get Windows 10 going somewhere to use all the new Win 10 stuff under Visual Studio 2015, but for other impatient folks (like me) to get the SD card set up quickly under windows 8.1, do this:

1. Download  Windows10_InsiderPreview_x64_EN-US_10074.iso to your PC from Microsoft

2. Mount the ISO image, (don’t install it yet- unless you really want to!)  copy the whole  .\sources\ folder across to your Windows 8.1 HDD, (I didn’t bother chasing down all the dism.exe dependencies, and there’s more than the few like named DLLs – maybe later). Say C:\TEMP\

3. Get the file Windows_IoT_Core_RPI2_BUILD.zip from Microsoft. Follow the steps here to sign up to MS Connect etc.

4. unzip the file, from among the contents copy the file Flash.ffu into the same folder as you copied the Windows 10 .\sources files, say C:\TEMP\

5. Put your SD card into your PC

6. use either Powershell (per Scott) or DISKPART (per Microsoft) to find the disk that is your  SD card (be careful, may not be good to get the wrong drive #).

7.from a command shell / dos window, running as admin  (just hit windows-x, then a), change to your C:\TEMP (or other) folder

8. using your drive number in place of the “N” below type:

dism.exe /Apply-Image /ImageFile:flash.ffu /ApplyDrive:\\.\PhysicalDriveN /SkipPlatformCheck

note. it is much easier if the Windows 10 dism and the flash.ffu are in the same directory.

9. Wait a minute or two as it writes out, and then eject the SD card (use the eject, or if mounted in a USB carrier – use the USB eject).

10. put the SD card in your Pi 2 and wait – it takes a minute or two to completely boot up, but it will get there.

Possible gotchas. I had a fail initially, I had formatted the SD card using FAT32. Tried to boot, nothing happened. Second time lucky, a quick reformat of the SD card using NTFS, same steps, and this worked. Was it a fluke? Unsure, but not losing sleep yet.

windows 8.1 running windows 10 dism to install Windows 10 IOT on raspberry pi 2

Enjoy!

Categories: IOT, Raspberry Pi 2, Windows 10

“Some of the properties associated with the solution could not be read” error + “See the Output Window” in VS2013

one or more of the projects in the solution were not loaded correctly

“one or more of the projects in the solution were not loaded correctly”

a look at the output window, as suggested was not very helpful:

Some of the properties associated with the solution could not be read

Some of the properties associated with the solution could not be read

The solution still loaded, CI Build was fine, TFS and Octopus deploy happy.

The answer: the problem turned out to be in the .sln solution file, two sets of projects were listed:

The fix: at the root of the solution (in my case) in Visual Studio 2013, right click, open folder in file explorer.

Use an editor like Notepad++ to edit the solution, and look for the phrase:

GlobalSection(TeamFoundationVersionControl)

followed by

SccNumberOfProjects = 

chances are there’s more than one of these. One needs to go, find which contains the correct projects + correct number of projects. In my case I had 2 of these sections. One section had SccNumberOfProjects = 10, the other SccNumberOfProjects = 9. I needed only to delete the block with the incorrect number of proejcts, bounded by these:

GlobalSection(TeamFoundationVersionControl) and EndGlobalSection

save the updated solution file, then let Visual Studio reload the solution following this change and things should return to normal.

Categories: programming Tags:

Don’t do this at home! … Windows 10 Preview + Server 2012 R2 Essentials Connector

or the perils of not really taking notice of the fine print.

Had some issues with my current build; thought time to blow it away, and why not have a crack at Windows 10. After it was not the first preview, and I wondered how it would go bare-metal instead of testing it in a VHD as I had in earlier releases.

The info at Preview-FAQ said Windows 10 Insider Preview is here today, but it’s a long way from done. We’re going to make it faster, better, … “ etc. and of course the usual warnings “Unexpected PC crashes could damage or even delete your files, so you should back up everything …”. Anyway I was even further was encouraged to try on my main machine after seeing that I could probably expect this preview would allow the ‘real’ Windows 10 to be upgraded into it and installed later, what better way to get a head start on Windows 10 development.

Unexpected – Windows 10 Insider Preview didn’t work with Server 2012 R2 Essentials connector, it almost thought about loading in compatibility mode, pretending it was Windows 8.x, but failed too. Seems this is high on the wish lists but still not in the features currently delivered.

Totally unexpected – found after Windows 10 finished installation on C: drive, a 1TB SSD that it decided to delete the partition on my D: drive.

End result, back to Windows 8.1 and to start the undelete of a 1TB of stuff that was my D: drive .

Categories: programming
Follow

Get every new post delivered to your Inbox.