Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 9 years ago.
Improve this question
I have an assembly data project in my solution that is being consumed by a different project. The data project contains three different edmx entries.
I'm calling a function import in one, but inside the edmx.cs I'm receiving an error on the calling line:
return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction
((IObjectContextAdapter)this).ObjectContext
is returning the type of a different context entirely! Thus it cannot find the function I'm calling.
Has anyone seen this behavior before? I don't know why it would be in one context and yet return the other type when the ObjextContext is checked.
A foolish mistake on my part. My connection string in the consuming project was pointing to the wrong csdl. The code compiles fine, you can update from the model perfectly, but it will break at runtime when the consuming project's config is used. Even though you can trace into the edmx.cs file for your data project, it will cast to the other model on the execution line.
Related
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 months ago.
Improve this question
I am following this tutorial on Youtube to begin my first ever Unity/C# project. However, I am stuck at about the 15 minute mark, where he uses
Invoke(nameof(ReloadLevel(), 1.3f));
at which point VSCode and Unity both object because "The name 'nameof' does not exist in the current context [Assembly-CSharp]"
Googling the issue shows this user and this user both being advised to update their programs, but mine are all freshly installed, so I'm not sure what the issue is. I am using VSCode 1.74.2, Unity 2021.3.16f1, and have the C# extension by Microsoft, v1.25.2. I have omnisharp.useModernNet set to false (the issue persists regardless of this being true or false, it seems), and .Net Framework 7.0.10 installed, alongside 4.7.1 .Net Dev Pack, as per the C# plugin instructions.
So far I have attempted to regenerate my "Assembly-CSharp.csproj" in case it was just somehow missing.
However, this hasn't worked. Uninstalling and reinstalling .Net with VSCode closed doesn't seem to have fixed it, either.
My expectation is that something just didn't generate properly - OR that the tutorial I'm following is too outdated (1 year), and there's a better way to call this method now. However, I am not sure how to google for that particular solution. Any help would be appreciated.
It's because of parantheses. You should write
Invoke(nameof(ReloadLevel), 1.3f);
Hope this helps.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I have a event whose publish method has a signature as follows:
publish((string moduleName,object moduleData) payload)
I have a set up a mockEventAggregator and other necessary setups but I need to verify if it has been called once.
I am having a tough time trying to write the verify statement as the parameter seems a bit complex and confusing to me on how to implement it, as I'm not able to get the syntax right.
here's what I'm trying:
this.mockModuleEvent.Verify(x => x.Publish(It.IsAny<(string,object)>(), Times.Once));
You have wrong brackets. Move one bracket from the end after It.IsAny<(string,object)>()
this.mockModuleEvent.Verify(x => x.Publish(It.IsAny<(string,object)>()), Times.Once);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
A quick question here lads, cannot run a visual studio project on another machine, receiving the CLR20r3 System.IO.DirectoryNotFound. The thing is that it has all resources needed inside the exe itself, and it's launching perfectly for me, both on debug and release versions, while crashing on any other machine. What can it possibly mean? Tried creating an installer, of course, same result. Works for me, doesn't work for others.
Thanks in advance.
Looks like the directory that you are trying to find is not present on the other machine.It would be hard to find and fix this error without knowing from where exactly the exception is thrown. Better add a try catch and log the exception somewhere like a text file or a remote database. Once you are able to get hold of the line where the exception is thrown and the actual exception, it would be lot easier to fix it. Hope it helps.
A silly mistake with not uploading properties with the project. And some weird problem with custom font, had to refer to it from properties directly. Case closed.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have a driver which is written in C#, .NET 4.7.0 and build as DLL. I don't have sources from this driver. I want to use this driver in python application.
I wrapped some functionality from driver into method of another C# project. Then I built it into DLL. I used RGiesecke.DllExport to make one method available in python. When i call this method from python using ctypes, I get WinError -532462766 Windows Error 0xe0434352.
If I exclude driver code and keep only wrapper code in exported method everything runs fine.
Could you please give me some advice how to make this working or help me find better sollution? Moving from python to IronPython is no option here.
Thank you.
PROBLEM CAUSE:
Python didn't run wrapper from directory where it was stored together with driver. That caused problem with loading driver.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 6 years ago.
Improve this question
I am having a problem deleting an image in my ASP.NET MVC 5 application.
I am creating a user management module of an application which requires images/photos of the staff uploaded. However, since the profile should be editable, the image should be made possible to be deleted. But when I try to delete the image, I find it difficult locating the correct path of the image. When I use
var fileToDelete = Path.Combine(Server.MapPath("~Content/photos/people/"),updatedStaff.Photo);
System.IO.File.Delete(fileToDelete);
or
`var fileToDelete = Server.MapPath("~Content/photos/people/"+updatedStaff.Photo);
System.IO.File.Delete(fileToDelete);`
The path returned for the image is wrong in that, it contains the controller and method in the path and so I cannot delete the image.
This is the error message I get:
Could not find a part of the path 'C:\Users\Josh\documents\visual studio 2015\Projects\EduPlus\EduPlus\staffmembers\edit\~Content\photos\people\de1e1cf0-d.jpg'
"staffmembers" is the controller and "edit" is the method
Please I will appreciate any assistance to figure out the problem.
Thank you
~/ is what you need to use before Content, not just ~ .
This should work perfectly fine.
var fileToDelete = Path.Combine(Server.MapPath("~/Content/photos/people"),
updatedStaff.Photo);