Closed DevZ1 closed 9 years ago
What are you doing exactly?
This sounds like a JSON formatting error and might be caused by the Json library not being loaded yet. Make sure you use the latest version of the library which addressed one of those scenarios.
A stacktrace might be helpful to pinpoint where exactly this is triggered from.
Hello Rick,
I'm also having this issue in my solution. I get the error when clicking Create Table on /LocalizationAdmin/. I'm running MVC 5 running .NET 4.5.1, with v2.0.50 of Westward.Globalization. NuGet.
Here's the stack trace -
at CallSite.Target(Closure , CallSite , Object , Object ) at Westwind.Web.JsonSerializers.JsonNetJsonSerializer.CreateJsonNetWriter(StringWriter sw) at Westwind.Web.JsonSerializers.JsonNetJsonSerializer.Serialize(Object value) at Westwind.Web.JsonSerializers.JSONSerializer.Serialize(Object value) at Westwind.Web.JsonCallbackMethodProcessor.ProcessCallbackMethodCall(Object target, String methodToCall)
Best, James
Checking on this now.
For some reason I can't reproduce this. So I know it should be working because the sample application that I use to test and build the Localization client with is an MVC application that works.
To check this out I also went ahead and created a new project as follows:
At this point resources are created and the table exists.
Can either of you try these steps just to verify that things are working under ideal circumstances? I'm not sure what else to try to duplicate.
The problem is caused by the Http Handler service and its use of JSON.NET. It appears it's failing to load JSON.NET properly. Either it's not finding the Newtonsoft.Json assembly or the version of the assembly is somehow out of date. However, with an ASP.NET MVC 5 project that should simply not be the case - since those projects have the assembly and are running Version 6. On a side note I've been considering just adding a NewtonSoft.Json as a hard dependency to Westwind.Web. I think part of the problem is that the assembly is loaded dynamically to avoid a hard reference and that's where the code is breaking. Having a hard reference would make this fail more reliably during compilation if there is a problem with versions.
One more thing - try updating the Westwind.Globalization.Web package to 2.0.52 (if you were using .50). I did another explicit piece of code to force JSON.NET to preload which may address this issue as well.
If you could try the steps above just to confirm that this works that would be awesome. If it does I can maybe take a look at your specific setup to determine why this isn't loading.
I'd really like to track this down ASAP.
Thanks!
Hi Rick,
the only way i could solve this is to create a new project (mvc 6 in VS2015) and add all project files to this new project, install all my nuget packages and also the globalization package. Now everything is working fine, but it ofcourse doesn't answer the question, where the solution / project file fails, so we can run the globalization webinterface.
I always used the latest version of your package, so this is not the problem. Keep up the great work and thank you for your support!
Grt, Halil.
Hi Rick,
Thank you for looking into this.
I have also created a new MVC5 application as you have, and got the Globalization working.
Looking at the version of Json.NET loaded in my existing project, it is indeed v6.0.8.
I have now taken a copy of the existing project, stripped out most of the 'real' code, etc and hosted it here - https://www.dropbox.com/s/4ejpi29aqwndkoj/hGem-stripped.zip?dl=0
Thanks again,
James
On 19 May 2015 at 20:38, Rick Strahl notifications@github.com wrote:
Checking on this now.
For some reason I can't reproduce this. So I know it should be working because the sample application that I use to test and build the Localization client with is an MVC application that works.
I also went ahead and created a new project as follows:
- New ASP.NET Web Application
- Choose MVC
- Choose No Authentication (shouldn't matter)
- Create
- Install-Package Westwind.Globalization.Web from NuGet
- Recompile project
- Create a new Db (so that the table doesn't exist)
- Change web.config to point at my new database
- Navigate to localizationAdmin/index.html
- I see the Object Localizations table doesn't exist error
- I click Create Table
At this point resources are created and the table exists.
Can either of you try these steps just to verify that things are working under ideal circumstances? I'm not sure what else to try to duplicate.
The problem is caused by the Http Handler service and its use of JSON.NET. It appears it's failing to load JSON.NET properly. Either it's not finding the Newtonsoft.Json assembly or the version of the assembly is somehow out of date. However, with an ASP.NET MVC 5 project that should simply not be the case - since those projects have the assembly and are running Version 6. On a side note I've been considering just adding a NewtonSoft.Json as a hard dependency to Westwind.Web. I think part of the problem is that the assembly is loaded dynamically to avoid a hard reference and that's where the code is breaking. Having a hard reference would make this fail more reliably during compilation if there is a problem with versions.
If you could try the steps above just to confirm that this works that would be awesome. If it does I can maybe take a look at your specific setup to determine why this isn't loading.
I'd really like to track this down ASAP.
Thanks!
— Reply to this email directly or view it on GitHub https://github.com/RickStrahl/Westwind.Globalization/issues/21#issuecomment-103647124 .
@kindjames - Thanks for sending your project - I was able to duplicate the problem. Still investigating WHY it is failing. As I suspected it's failing at the instantiation of the dynamic instance of the JSON.NET serializer. I found where it's failing but I can't understand for the life of me WHY it's failing in your projects and not the new ones. I ensured the versions are the same and the assembly redirects are, but for reasons I don't understand it fails in the old project.
I have a workaround that will make this work (avoid using dynamic for some of these calls and use Reflection instead), but that still doesn't explain why the dynamic calls are failing sometimes and not at others.
Ultimately I think the solution is to rip out the dynamic JSON.NET loading and just use a hard reference in Westwind.Web. At the time when the handler was written JSON.NET wasn't a common fixture, but now just about every Web project has it anyway. That fix will take a little more work and testing however.
I'll have an update out later today that should address this.
Again thanks for your help in tracking this one down!
Ok guys, I've updated the Westwind.Globalization.Web NuGet package with an update that removes the dynamic JSON.NET functionality and uses a proper hard reference to it instead. This appears to have taken care of this odd behavior.
In your projects you should now be able to do:
Update-Package westwind.globalization.web
which should replace the assemblies and make the JSON serialization work properly.
Thanx Rick, will test it tomorrow and let you know if it works. Getting late here in holland so time to sleep :-) Op 20 mei 2015 22:59 schreef "Rick Strahl" notifications@github.com:
Ok guys, I've updated the Westwind.Globalization.Web NuGet package with an update that removes the dynamic JSON.NET functionality and uses a proper hard reference to it instead. This appears to have taken care of this odd behavior.
In your projects you should now be able to do:
Update-Package westwind.globalization.web
which should replace the assemblies and make the JSON serialization work properly.
— Reply to this email directly or view it on GitHub https://github.com/RickStrahl/Westwind.Globalization/issues/21#issuecomment-104036545 .
@RickStrahl I can confirm this is now working for me! Thank you so much :)
Hi Rick,
i can't get this to work in my solution? I always get this error in your resource editor: 'object' does not contain a definition for 'ObjectCreationHandling' and i'm unable to fix it. Refreshing the screen a couple of times results into a blank page. All settings in webconfig are correct and existing resources are pulled from DB. I have migrated all the resources in old version to new localization table.
Is there some kind of json size limit (i have 219 resource records)?
Another error i'm getting is :
'object' does not contain a definition for 'Formatting'