New Posts New Posts RSS Feed: Key error
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Key error

 Post Reply Post Reply
Author
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Topic: Key error
    Posted: 05-Nov-2012 at 2:43pm
I've encountered a strange issue when attempting to use code first. When the SL project reads the EncodedLicenseKey it is unable to decrypt it (See below) I've used the license key util and confirmed my product key in the registry is correct. I've deleted the ibmmx files, even remade my model.



Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 05-Nov-2012 at 2:50pm
I've patched it for now by manually encrypting my key and placing it in my ibmmx. So somehow my ibmmx is not getting the right key.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 05-Nov-2012 at 5:40pm
Can you tell me what kind of key you have (eg, Universal)?  Also, when you installed 7.0.2, did you re-enter your license key?
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 05-Nov-2012 at 6:23pm
DataCenterServer, Universal. I believe I did re-enter my key.

I also have a problem building my Silverlight model dll.

Parameter:ProjectFile=C:\Path\Project\Dev\Source\Project\Project\Project.Model.SL\Project.Model.SL.csproj (TaskId:86)
  Task Parameter:TargetFolder=C:\Path\Project\Dev\Source\Project\Project\Project.Model.SL (TaskId:86)
  In EntityModelMetadataDeploy.  Parms:  Assembly='C:\Path\Project\Dev\Source\Project\Project\Project.Model.SL\Bin\Release\Project.Model.SL.dll', TargetFolder='C:\Path\Project\Dev\Source\Project\Project\Project.Model.SL' (TaskId:86)
  IdeaBlade.VisualStudio.Build.Tasks, Version=7.0.2.0, Culture=neutral, PublicKeyToken=287b5094865421c0 (TaskId:86)
C:\Path\packages\IdeaBlade.DevForce.Aop.7.0.2\tools\IdeaBlade.DevForce.Common.targets(61,5): error MSB4018: The "EntityModelMetadataDeploy" task failed unexpectedly.
C:\Path\packages\IdeaBlade.DevForce.Aop.7.0.2\tools\IdeaBlade.DevForce.Common.targets(61,5): error MSB4018: System.IO.FileNotFoundException: Could not load file or assembly 'Project.Model.SL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
C:\Path\packages\IdeaBlade.DevForce.Aop.7.0.2\tools\IdeaBlade.DevForce.Common.targets(61,5): error MSB4018: File name: 'Project.Model.SL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'

(I've shortened the paths so it's easier to read)

As you can see in the trace log, the right dll is being passed to the Assembly property on EntityModelMetadataDeploy. Something just seems really odd. This happens on two machines that I have tested.

The dependencies on my model project are IdeaBlade, PostSharp.SL and Microsoft.CompilerServices.AsyncTargetingPack. Nothing special.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 05-Nov-2012 at 9:05pm
This is really odd.  Do you also have DevForce 2010 installed?
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2012 at 5:57am
I think I've found the problem. I think there is a metadata issue in my model. Looking at the SourceAssemblyName property on EntityModelMetadata, if it doesn't find any it will encrypt it with  "[Not available]"; so when it decrypts, it's obviously failing. 
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2012 at 6:24am
I had a custom DbContext but neglected to define any DbSet properties on it. Once I added these in it is working.

I still have the issue building my Model.SL project so I removed the DevForce.Common.Targets, I'm not sure why/how the Silverlight project would use this build task anyways.
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2012 at 8:15am
Interesting. We should detect when the metadata collection is empty and throw a meaningful error, and not allow the license key problem you're seeing to occur.
 
You're right you don't need the DevForce targets in your Silverlight project, since metadata is only built in the .NET project. We've got an open defect to correct this. You can also remove the .cf file from the project, which will also disable the EntityModelMetadataDeploy task.
 
I'm glad you were able to resolve these.
Back to Top
mgood View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 18-Nov-2010
Location: Emeryville, CA
Posts: 583
Post Options Post Options   Quote mgood Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2012 at 10:13am
Originally posted by smi-mark

I had a custom DbContext but neglected to define any DbSet properties on it. Once I added these in it is working.

I still have the issue building my Model.SL project so I removed the DevForce.Common.Targets, I'm not sure why/how the Silverlight project would use this build task anyways.

Mark,
As Kim says above. Remove the DevForce.cf file from all your Silverlight projects. The beta package added the cf file to all project types and there was a change in RTW that causes it to try to generate the metadata even in Silverlight. You can leave the build task as long as the project doesn't contain a .cf file. 
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 06-Nov-2012 at 2:53pm
Yea - this is where I went wrong. I noticed Temphire (I was looking at a 2.0 version based on beta) had it so I assumed I needed it in mine
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down