PRISM Unity RegisterType fails
up vote
0
down vote
favorite
I am using C# 4.7.2 and PRISM Unity 6.2.0
There's an interface, which looks like this
using System;
namespace MyNameSpace
public interface IMyAnswer
Guid GUID get; set;
dynamic Answer get; set;
and there's a class implementing that interface:
using System;
namespace MyNameSpace
internal class MyAnswer: IMyAnswer
public Guid GUID get; set;
public dynamic Answer get; set;
I'm trying to register the type like this
container.RegisterType<IMyAnswer , MyAnswer>();
container is of type IUnityContainer.
A System.TypeLoadException is thrown 'The Type IMyAnswer could not be loaded'
I removed the line and everything worked as before. I wrote the line again and the same exception occured again. I removed the line again, but then the following registrations threw the same exception, even though they didn't before.
Can anyone help me here, please?
Addition:
The interface is located in a different project than the class. Wasn't and isn't a problem in case of several other registrations.
The version of the project / dll which contains the interface is mentionend in the error event as 1.0.0.0. I didn't know wether it's the file version or the assembly version. So I changed both numbers to different values. I removed the reference, cleaned and built the dll with the interface, added the reference again. Cleaned and rebuilt the dll containing the class. Both of the builds succeeded. I ran the application and the error is the same. The interesting part is now, that the version wich is mentioned in the error is still 1.0.0.0.
Is it possible, that through all the builds nothing has changed at all?
Addition 2:
Assuming the name of the dll containing the interface would be MyInterfaces.dll. The Logger states this:
C:PathMyInterfaces.dll'. Cannot find or open the PDB file
The pdb file does exist in C:Path. There are no restrictions on reading or writing neither on the folder or on the file itself.
Solution:
It turned out to a building problem. The solution is described here:
Visual Studio Build seems not to use current projects
c# unity-container registration
add a comment |
up vote
0
down vote
favorite
I am using C# 4.7.2 and PRISM Unity 6.2.0
There's an interface, which looks like this
using System;
namespace MyNameSpace
public interface IMyAnswer
Guid GUID get; set;
dynamic Answer get; set;
and there's a class implementing that interface:
using System;
namespace MyNameSpace
internal class MyAnswer: IMyAnswer
public Guid GUID get; set;
public dynamic Answer get; set;
I'm trying to register the type like this
container.RegisterType<IMyAnswer , MyAnswer>();
container is of type IUnityContainer.
A System.TypeLoadException is thrown 'The Type IMyAnswer could not be loaded'
I removed the line and everything worked as before. I wrote the line again and the same exception occured again. I removed the line again, but then the following registrations threw the same exception, even though they didn't before.
Can anyone help me here, please?
Addition:
The interface is located in a different project than the class. Wasn't and isn't a problem in case of several other registrations.
The version of the project / dll which contains the interface is mentionend in the error event as 1.0.0.0. I didn't know wether it's the file version or the assembly version. So I changed both numbers to different values. I removed the reference, cleaned and built the dll with the interface, added the reference again. Cleaned and rebuilt the dll containing the class. Both of the builds succeeded. I ran the application and the error is the same. The interesting part is now, that the version wich is mentioned in the error is still 1.0.0.0.
Is it possible, that through all the builds nothing has changed at all?
Addition 2:
Assuming the name of the dll containing the interface would be MyInterfaces.dll. The Logger states this:
C:PathMyInterfaces.dll'. Cannot find or open the PDB file
The pdb file does exist in C:Path. There are no restrictions on reading or writing neither on the folder or on the file itself.
Solution:
It turned out to a building problem. The solution is described here:
Visual Studio Build seems not to use current projects
c# unity-container registration
Does it act the same way ifMyAnswer
ispublic
?
– mjwills
Nov 11 at 7:41
Yes, it does. The Exception points to the interface, not the class. I registered several classes in the exact same way without any problems. But I can't find a difference. I tried to declare Answer as object instead of dynamic. Changed nothing.
– GeorgeDuke
Nov 11 at 7:53
Does stackoverflow.com/a/15009187/34092 help?
– mjwills
Nov 11 at 9:01
Unfortunately, no it doesn't. But please have a look at the recent update of my post.
– GeorgeDuke
Nov 11 at 9:41
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am using C# 4.7.2 and PRISM Unity 6.2.0
There's an interface, which looks like this
using System;
namespace MyNameSpace
public interface IMyAnswer
Guid GUID get; set;
dynamic Answer get; set;
and there's a class implementing that interface:
using System;
namespace MyNameSpace
internal class MyAnswer: IMyAnswer
public Guid GUID get; set;
public dynamic Answer get; set;
I'm trying to register the type like this
container.RegisterType<IMyAnswer , MyAnswer>();
container is of type IUnityContainer.
A System.TypeLoadException is thrown 'The Type IMyAnswer could not be loaded'
I removed the line and everything worked as before. I wrote the line again and the same exception occured again. I removed the line again, but then the following registrations threw the same exception, even though they didn't before.
Can anyone help me here, please?
Addition:
The interface is located in a different project than the class. Wasn't and isn't a problem in case of several other registrations.
The version of the project / dll which contains the interface is mentionend in the error event as 1.0.0.0. I didn't know wether it's the file version or the assembly version. So I changed both numbers to different values. I removed the reference, cleaned and built the dll with the interface, added the reference again. Cleaned and rebuilt the dll containing the class. Both of the builds succeeded. I ran the application and the error is the same. The interesting part is now, that the version wich is mentioned in the error is still 1.0.0.0.
Is it possible, that through all the builds nothing has changed at all?
Addition 2:
Assuming the name of the dll containing the interface would be MyInterfaces.dll. The Logger states this:
C:PathMyInterfaces.dll'. Cannot find or open the PDB file
The pdb file does exist in C:Path. There are no restrictions on reading or writing neither on the folder or on the file itself.
Solution:
It turned out to a building problem. The solution is described here:
Visual Studio Build seems not to use current projects
c# unity-container registration
I am using C# 4.7.2 and PRISM Unity 6.2.0
There's an interface, which looks like this
using System;
namespace MyNameSpace
public interface IMyAnswer
Guid GUID get; set;
dynamic Answer get; set;
and there's a class implementing that interface:
using System;
namespace MyNameSpace
internal class MyAnswer: IMyAnswer
public Guid GUID get; set;
public dynamic Answer get; set;
I'm trying to register the type like this
container.RegisterType<IMyAnswer , MyAnswer>();
container is of type IUnityContainer.
A System.TypeLoadException is thrown 'The Type IMyAnswer could not be loaded'
I removed the line and everything worked as before. I wrote the line again and the same exception occured again. I removed the line again, but then the following registrations threw the same exception, even though they didn't before.
Can anyone help me here, please?
Addition:
The interface is located in a different project than the class. Wasn't and isn't a problem in case of several other registrations.
The version of the project / dll which contains the interface is mentionend in the error event as 1.0.0.0. I didn't know wether it's the file version or the assembly version. So I changed both numbers to different values. I removed the reference, cleaned and built the dll with the interface, added the reference again. Cleaned and rebuilt the dll containing the class. Both of the builds succeeded. I ran the application and the error is the same. The interesting part is now, that the version wich is mentioned in the error is still 1.0.0.0.
Is it possible, that through all the builds nothing has changed at all?
Addition 2:
Assuming the name of the dll containing the interface would be MyInterfaces.dll. The Logger states this:
C:PathMyInterfaces.dll'. Cannot find or open the PDB file
The pdb file does exist in C:Path. There are no restrictions on reading or writing neither on the folder or on the file itself.
Solution:
It turned out to a building problem. The solution is described here:
Visual Studio Build seems not to use current projects
c# unity-container registration
c# unity-container registration
edited Nov 15 at 8:46
asked Nov 11 at 7:32
GeorgeDuke
86
86
Does it act the same way ifMyAnswer
ispublic
?
– mjwills
Nov 11 at 7:41
Yes, it does. The Exception points to the interface, not the class. I registered several classes in the exact same way without any problems. But I can't find a difference. I tried to declare Answer as object instead of dynamic. Changed nothing.
– GeorgeDuke
Nov 11 at 7:53
Does stackoverflow.com/a/15009187/34092 help?
– mjwills
Nov 11 at 9:01
Unfortunately, no it doesn't. But please have a look at the recent update of my post.
– GeorgeDuke
Nov 11 at 9:41
add a comment |
Does it act the same way ifMyAnswer
ispublic
?
– mjwills
Nov 11 at 7:41
Yes, it does. The Exception points to the interface, not the class. I registered several classes in the exact same way without any problems. But I can't find a difference. I tried to declare Answer as object instead of dynamic. Changed nothing.
– GeorgeDuke
Nov 11 at 7:53
Does stackoverflow.com/a/15009187/34092 help?
– mjwills
Nov 11 at 9:01
Unfortunately, no it doesn't. But please have a look at the recent update of my post.
– GeorgeDuke
Nov 11 at 9:41
Does it act the same way if
MyAnswer
is public
?– mjwills
Nov 11 at 7:41
Does it act the same way if
MyAnswer
is public
?– mjwills
Nov 11 at 7:41
Yes, it does. The Exception points to the interface, not the class. I registered several classes in the exact same way without any problems. But I can't find a difference. I tried to declare Answer as object instead of dynamic. Changed nothing.
– GeorgeDuke
Nov 11 at 7:53
Yes, it does. The Exception points to the interface, not the class. I registered several classes in the exact same way without any problems. But I can't find a difference. I tried to declare Answer as object instead of dynamic. Changed nothing.
– GeorgeDuke
Nov 11 at 7:53
Does stackoverflow.com/a/15009187/34092 help?
– mjwills
Nov 11 at 9:01
Does stackoverflow.com/a/15009187/34092 help?
– mjwills
Nov 11 at 9:01
Unfortunately, no it doesn't. But please have a look at the recent update of my post.
– GeorgeDuke
Nov 11 at 9:41
Unfortunately, no it doesn't. But please have a look at the recent update of my post.
– GeorgeDuke
Nov 11 at 9:41
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53246711%2fprism-unity-registertype-fails%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Does it act the same way if
MyAnswer
ispublic
?– mjwills
Nov 11 at 7:41
Yes, it does. The Exception points to the interface, not the class. I registered several classes in the exact same way without any problems. But I can't find a difference. I tried to declare Answer as object instead of dynamic. Changed nothing.
– GeorgeDuke
Nov 11 at 7:53
Does stackoverflow.com/a/15009187/34092 help?
– mjwills
Nov 11 at 9:01
Unfortunately, no it doesn't. But please have a look at the recent update of my post.
– GeorgeDuke
Nov 11 at 9:41