Edit3: Sorry for the constant edits, I’m sure there’s a law which states progress is only made once you’ve publicly requested a solution.
I’ve opened the oracle assembly in Reflector. The assembly includes a reference to the both the v1.0.3705 mscorlib AND the 2.0.0.0 mscorlib…
It also references a Common.Logging assembly which targets the v1.0.3705 runtime.
This strikes me as at best odd. Anyone ever seen something like this before?
Edit2: Ok, created a WPF application against 3.5. Referenced my API library, added a line to call the code that declares a variable of an interface type declared in the Oracle library and it all works.
So the problem only occurs with Framework 4 applications. This makes a certain amount of sense to me as 3.5 is essentially 2 with some extra libraries. But I’m now confused as to why I can reference a 2 assembly in my 4 project and use its types, just not this Oracle one, and with an unhelpful error.
Edit: Seems to be an issue with the framework version. I’m suprised I haven’t encountered something like this before.
Here’s the new situation:
Added new Windows forms application set to Framework 2.
Added reference to Coherence DLL in GAC (It never appears in references under assemblies, is that bad?) using path.
Added button with line “INamedCache cache;” That’s it. compiled and run. All works fine.
Step 2, remove reference to coherence, add reference to my original API. Compile, all works fine. Remember the API is just running the line of code above.
Now, if I add a reference to the Windows forms application to my WPF application, and create a Form1, again, all the IntelliSense works, but when you compile it gives a “type or namespace not found”.
Again, remove the “INamedCache cache;” from the Form1 in the forms application (still referenced by the WPF application) and it all compiles again.
So my WPF Framework 4 application will consume my framework 2 windows forms application (with Forms 2 reference added of course) but if that forms application contains a reference to the oracle library AND declares a variable of an interface type declared in that library. boom, instant failure.
Original post here:
Visual Studio 2010.
I have a WPF windows app project and a class library. The class library references Oracle’s Coherence for .NET assembly. The class library has one class with one method which declares a variable of an interface type.
The WPF application has a button which calls this method. IntelliSense works fine.
When I try to compile I get the old “The type or namespace named ‘WhyAreYouNotWorking’ could not be found” error. I have a demo project which does run, I’ve copied the references from one to the other with no luck. I’ve added references to any supporting assemblies.
Also
public void Test()
{
INamedCache cache;
//CacheFactory.SetCacheFactoryConfig("coherence.xml");
//CacheFactory.SetCacheConfig("cache-config.xml");
//CacheFactory.SetPofConfig("pof-config.xml");
//INamedCache cache = CacheFactory.GetCache("ians-cache");
//Console.WriteLine(cache.CacheName);
}
Above you see the one method in my class lib. This lib will compile happily with all those lines commented or uncommented. The WPF application will only compile if I rem out ALL the lines.
So the problem here is the WPF application will not compile with a reference to the class library, if the class library includes code contained in the Coherence Oracle .net assembly.
I’m baffled. Slightly embarrassed and baffled 🙂
Gotcha.
WPF 4.0 application had defaulted to “.NET framework 4 Client Profile”. Switching it to “.NET Framework 4” resolved all the problems.
Still don’t fully understand why.