pinning in the memory

Hi, my code is

...
...
Private Color[] cols;
Private GCHandle cols_handle
cols = texture.GetPixels(0);
cols_handle = GCHandle.Alloc(cols, GCHandleType.Pinned);
...
...
<Plugin>myFunction(cols_handle.AddrofPinnedObject());

But I am getting on the last line written above InvalidOperationException: The handle is not of Pinned type System.Runtime.InteropServices.GCHandle.AddrOfPinnedObject()

Please someone tell me WHYYYY I am getting this error !!! while I am clearly setting the handle (cols_handle) to type Pinned ??

I have gone mad.. Help would be highly appreciated.

Thanks

oh gosh, sorry for wasting ur time i used void start() instead of void Start() so it was not initializing the variables , functions and all now its ok

Are you absoloutely sure that cols_handle is called after being pinned, and isn't freed before being used?

The code itself looks fine, but it'll screw up if the bits where you put ... modify the handle