Print Page | Close Window

Works in dev but not in Prod

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2012
Forum Discription: For .NET 4.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=4675
Printed Date: 31-Oct-2024 at 9:07pm


Topic: Works in dev but not in Prod
Posted By: katit
Subject: Works in dev but not in Prod
Date Posted: 09-Apr-2014 at 12:41pm
Really puzzled, never seen something like this and error message is not helping.

Code:


try
               {
                    this.IsBusy = true;
                    var queryCarrier = from c in entityManager.DSPCarriers
                                       join con in entityManager.LOCContacts on c.PrimaryContactKey equals
                                           con.ContactKey
                                       where c.CarrierKey.Equals(this.CurrentItem.CarrierKey.Value)
                                       select new { con.FirstName, con.LastName };

                    var carrierResults = await queryCarrier.ExecuteAsync();
                    var cr = carrierResults.FirstOrDefault();
                    if (cr != null)
                    {
                        firstName = cr.FirstName;
                        lastName = cr.LastName;
                    }
               }
               catch (Exception ex)
               {
                    this.LoggerService.LogAsync(ex, "MaintainExpressCheckViewModel.Retrieve");
               }
               finally
               {
                    this.IsBusy = false;
               }


I assume it is related to how I run query, async\anonymous etc but such query being sent to server just fine on my dev machine.

When I install on server I get following exception(logged):

Error 0x2115. Debugging resource strings are unavailable. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.30214.0&File=mscorrc.dll&Key=0x2115

at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at aa.Module.bb.Views.MaintainExpressCheckViewModel.<Retrieve>d__4.MoveNext()

Why is this happening and is there any way to get more error details?



Replies:
Posted By: DenisK
Date Posted: 09-Apr-2014 at 4:08pm
Hi katit,

Can you see what the exception type is?


Posted By: katit
Date Posted: 09-Apr-2014 at 4:17pm
I will try to check (not logging this currently)

After changing select to "select con" it works everywhere. I just don't need whole entity..


Posted By: katit
Date Posted: 11-Apr-2014 at 7:50am
Actually it still happens.

I logged exception type:

Type: System.MethodAccessException     SL:MaintainExpressCheckViewModel.Retrieve

Error 0x2115. Debugging resource strings are unavailable. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.30214.0&File=mscorrc.dll&Key=0x2115     SL:MaintainExpressCheckViewModel.Retrieve     
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess(Task task)
   at IDATT.Module.RatePay.Views.MaintainExpressCheckViewModel.<Retrieve>d__4.MoveNext()


Posted By: DenisK
Date Posted: 11-Apr-2014 at 11:39am
That sounds like an SL assembly trust issue when dealing with "complex" queries.

Please see the following code snippet on how you may need to grant trust on the assembly containing this query.

https://github.com/IdeaBlade/Cocktail/blob/master/Samples/TempHire/DomainModel.SL/Properties/AssemblyInfo.cs


Posted By: katit
Date Posted: 11-Apr-2014 at 12:23pm
Hm. It does. I wonder why it runs on dev? Is because of Dev version of Silverlight?

Anyway.. Where do I put this code and does it mean I have to remember and update versions every time I upgrade DevForce?

I have PRISM application with main.SL, modules.SL(many), and some shared libraries:

model.SL (with IB entities, etc)
infrastructure.SL

Do I add this to module where this code is or to model.SL ?

Also, I'm not sure what that sample project structure is, why this?
[assembly: InternalsVisibleTo("DomainServices.SL")]


Posted By: DenisK
Date Posted: 11-Apr-2014 at 1:13pm
Sorry for the confusion. You just need to add the following to your SL DomainModel assembly,

// These allow the expression tree built by DevForce for certain complex queries to be processed correctly
// in Silverlight. Without it, some complex queries may fail with a MethodAccessException.
[assembly: InternalsVisibleTo("System.Core, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab")]
[assembly: InternalsVisibleTo("System.Runtime.Serialization, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab")]
[assembly: InternalsVisibleTo("IdeaBlade.Core.SL, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b3f302890eb528"
+ "1a7ab39b936ad9e0eded7c4a41abb440bead71ff5a31d51e865606b2a7e6d0b9dd0d92b113b9d1"
+ "0fb13f01fb5d856e99c1e61777cf4772d29bad7e66ffb93fc5cbd63b395046c06ff57db6ecbeee"
+ "4bdd6effc405878d65cfc4911708ed650da935d733fc5dc707f74910e025ac080543e01a6cc863"
+ "b9f85ffc")]

I'm also at a loss as to why it runs on dev.

If the fix works in prod, you may want to check that you're running the query over the same set of data because that can affect how complex the expression tree is built, and so may explain why it works on dev.



Posted By: katit
Date Posted: 14-Apr-2014 at 12:49pm
Data structure is the same. EF not "smart" enough to make different queries depending on data, right? (I hope)

Adding this to my Model.SL fixed issue.

Thank you!


Posted By: katit
Date Posted: 17-Apr-2014 at 2:45pm
Ok.. Nope. It didn't fix it. And it wasn't a problem to begin with. It work on all machines except mine (I have 2 PC's thats why confusion)

So, one Windows 7 Ultimate, latest Silverlight, all the same. I tried to uninstall Silverlight, reinstall, installed all IE updates. IE seem to be working properly, whole app seems to work OK except I get this error. Other clients don't. Any ideas on what might be causing this?

I need to figure out to know how to deal with a problem if customers have it..


Posted By: katit
Date Posted: 23-Apr-2014 at 6:56am
Ok. It DID fix it after I added instructions (InternalsVisibleTo) to my MODULE assembly (this is where query is, not model.SL).

So, it's really weird. It was working OK on older browsers. It started to work in all IE 11 browsers after this fix. In my IE11 I was getting this error in 1 spot, other users with IE11 were getting this error in different spot...



Print Page | Close Window