First, my apologies. This post might be a bit too vague. I have a problem I cannot reproduce in a small sample code section. Here is what I do:
F# application uses a C# DOM, generated from an XML Schema (xsd.exe).
The instance of the DOM is created in C# and returned to F# application from a function call.
The instance (here named type is 'X') is stored into a f# record like this:
type Something = { Dom : X option }
Later in the code I have something like this:
match myRecord.Dom with
| Some(dom) -> CSharpCode.Save( dom, filepath ) // error: Type 'X' not compatible with type 'X'
So basically, I get the Dom instance from C# and pass it back. In the last line above, I get the error message mentioned in the title: Type 'X' is not compatible with type 'X'.
I have no idea what I should look for as in my simple sample program where I try to reproduce this, I never run into this error. Any ideas?
Looking at this troubleshooting page, the phrase 'not compatible with type' seems to be used in the context of numerical values, rather than general type matching.
Another guess is that your code sample has CSharpCode.Save( dom, filepath )
, but in F# function arguments are whitespace-separated rather than comma-separated, so I would have expected CSharpCode.Save dom filepath
. Wouldn't your sample be constructing a tuple of dom, filepath
and attempting to pass it to .Save
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With