jamesmontemagno / monkey-cache

Easily cache any data structure for a specific amount of time in any .NET application.
MIT License
665 stars 105 forks source link

No strong name signed assemplies #99

Closed Kultman closed 3 years ago

Kultman commented 3 years ago

Trying to use Monkey Cache for a ClickOnce deployed windows app. I keep getting an error about assemblies not being signed. I've tried using .NET assembly Strong name-signer, which works for the Monkey cache dll and Monkey Cache sqllite dll, but then the problem just moves to the sqllite assemblies. Anyone else seen that problem?

jamesmontemagno commented 3 years ago

Have you looked at -> https://github.com/dsplaisted/strongnamer

Kultman commented 3 years ago

I found something like it, just installed Nuget Package and Bob became my uncle, so to speak... :) Brutal.Dev.StrongNameSigner package takes care of it all automatically, pretty nice.

But now I'm getting this error in stead... This error is for FileStore, but have tried with SqlLite also, same issue... image

Error text is in danish, which is a pain, don't know how to get that to be in english :) Something about not being able to access a method to Get BasePath... It appears when I try to get data for the first time: DocumentList.DataSource = Barrel.Current.Get(Of List(Of PrintDocument))("Documents")

Thought it might be caused by rights to file system, my PC recently got put in our domain and I lost my local admin rights. So I thought moving Base Path to MyDocuments might help... but no...

    ```

'BarrelUtils.SetBaseCachePath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)) Barrel.ApplicationId = "DigitalTryk"



I'm using MonkeyCache in a Xamarin project and have grown very fond of it, not being able to use it in a Windows app is a bit of a bummer. And yes, I code VB.NET for windows apps and C# for Xamarin and WebAPI - I'm originally from the VB comunity but am a bit agnostic about it now... :)
jamesmontemagno commented 3 years ago

What type of app is this that is throwing the error?

jamesmontemagno commented 3 years ago

You will probably need to set the cache directory directly if it isn't a platform I support -> https://github.com/jamesmontemagno/monkey-cache#persisting-data-longer

Kultman commented 3 years ago

It's a standard Winforms application in VB.NET, using Telerik controls. And I am setting cache directory to MyDocuments with BarrelUtils.SetBaseCachePath(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))

jamesmontemagno commented 3 years ago

I will give this a test to see. Is it .NET Core or Framework?

Kultman commented 3 years ago

It's a Framework 4.8 project

jamesmontemagno commented 3 years ago

So, I created a winforms app with framework 4.8 and it seems to be working alright here. WindowsFormsApp1.zip

Kultman commented 3 years ago

Ya, I see that your project works. Mine still doesn't...

I'll been testing things to isolate problem. So far I've tested elevated admin rights, same problem. Created VB.NET project to see if it a VB specific problem, my clean VB.NET projects also works, so no it's not VB. Did a complete reinstall of all Nuget packages, did no difference. Turned off signing with no effect...

There is something in my projects that MonkeyCache really doesn't like tho... Still don't know what. But I'll create a new branch and peel off everything layer by layer and find out what is conflicting with Monkeycache. Don't have time for this within the next 2 weeks, so I'll get back to you on this...

And by the way, big fan, thanks for videos on Xamarin :)

jamesmontemagno commented 3 years ago

Could always grab the source code directly and add it to your project :) it is pretty much a single file :)

Kultman commented 3 years ago

I think I found the cause of this error. Was working on an old project and wanted to replace a SQLServerLocalDB implementation with MonkeyCache. Again I'm deploying with ClickOnce and have signed the assembly with a strong name key file. Have also signed the manifest with a Code signing certificate. The assembly signing gives an error, because your package is unsigned, so I installed Brutal.Dev.StrongNameSigner - this automatically signs unsigned packages. And this Nuget package gives me this mysterious error I reported. Removed assembly signing and kept the Code signing and now MonkeyCache seems to work.