# Type conversion error

**URL:** <https://www.ruby-forum.com/t/type-conversion-error/198875>\
**Category:** IronRuby\
**Created:** [November 9, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/type-conversion-error/198875 "2010-11-09T21:54:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 9, 2010, 9:54pm UTC](https://www.ruby-forum.com/t/type-conversion-error/198875/1 "2010-11-09T21:54:12Z")

</div>

Has anyone run into type conversion errors where you get a message like:

can’t convert PcapFileHandler::PcapFileWriter into  
PcapFileHandler::PcapFileWriter (TypeError)

when doing:

packetHandlerWrapper.PcapWriter =  
NetworkMiner::PacketHandlerWriter.clr\_new("", someobj)

I am totally buggered up with this. The packetHandlerWrapepr.PcapWriter  
is  
nil when I inspect it with ruby.

I have to solve this by tonight :’(

-a

–  
If I had six hours to chop down a tree, Id spend the first four of them  
sharpening my axe.

-Abraham Lincoln

---

<div class="post-metadata">

**Author:** ![andrew\_Wilson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@andrew\_Wilson](https://www.ruby-forum.com/u/andrew_Wilson)\
**Post date:** [November 9, 2010, 10:37pm UTC](https://www.ruby-forum.com/t/type-conversion-error/198875/2 "2010-11-09T22:37:29Z")

</div>

Yes, you probably have the assembly that defines the type loaded twice  
in different load contexts (Load vs LoadFrom).  
That might happen if you load the assembly using a file path (require  
‘x.dll’) instead of a full assembly name and then dependency loads it as  
well.

Tomas

From: removed\_email\_address@domain.invalid  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of andrew Wilson  
Sent: Tuesday, November 09, 2010 12:38 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Ironruby-core] Type conversion error

Has anyone run into type conversion errors where you get a message like:

can’t convert PcapFileHandler::PcapFileWriter into  
PcapFileHandler::PcapFileWriter (TypeError)

when doing:

packetHandlerWrapper.PcapWriter =  
NetworkMiner::PacketHandlerWriter.clr\_new(“”, someobj)

I am totally buggered up with this. The packetHandlerWrapepr.PcapWriter  
is nil when I inspect it with ruby.

I have to solve this by tonight 😢

-a

–  
“If I had six hours to chop down a tree, I’d spend the first four of  
them sharpening my axe”.

-Abraham Lincoln

---

<div class="post-metadata">

**Author:** ![andrew\_Wilson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/278dde/32.png) [@andrew\_Wilson](https://www.ruby-forum.com/u/andrew_Wilson)\
**Post date:** [November 9, 2010, 11:24pm UTC](https://www.ruby-forum.com/t/type-conversion-error/198875/3 "2010-11-09T23:24:37Z")

</div>

On Tue, Nov 9, 2010 at 10:18 PM, Tomas M. \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> 

What is it with this big blue font, Tomas? 😃
