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










share|improve this question























  • 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











  • 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














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










share|improve this question























  • 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











  • 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












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










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 at 8:46

























asked Nov 11 at 7:32









GeorgeDuke

86




86











  • 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











  • 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










  • 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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

Evgeni Malkin