how to step into system.web.mvc - asp.net-mvc

Does anyone have know how I can step into system.web.mvc? I am getting an error (Cannot create an abstract class) that is buried in the System.Web.Mvc.DefaultModelBinder.CreateModel method, and I can't tell which part of my code is causing the issue.
I was advised that I could download the sourcecode from codeplex, (actually microsoft.com/downloads as I am using 1.0), build in Debug and then step through. I tried, unfortunately the system.web.mvc was installed in GAC, thus causing an ambiguous call, and gacutil would not allow me to uninstall, so tried by hand removing from the registry (HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Global\system.web.mvc). when I ran my program it was still reporting an ambiguous call.
Background
A couple of weeks ago I had a problem where MVC was throwing up a YSOD, but I could not step into the code to find the problem because the issue was I was doing something wrong, that was not being picked up until it was in the framework (in this case, by thrashing around blindly for a day I found it was that I didn't have a default empty constructor on one of the classes within my viewmodel). Now I am getting a different error (Cannot create an abstract class) that is buried in the System.Web.Mvc.DefaultModelBinder.CreateModel method, but I don't know what part of my code is causing the error in the framework.

It's a little involved, but you can do it. Steve Sanderson has step-by-step instructions.

If you have the source code then you can recompile the code using a different assembily name and reference that.

Related

F# build error: "No compiled representation for provided namespace"

Has anyone run into this error message before? Google found it for me in the source code (https://github.com/fsharp/fsharp/blob/master/src/fsharp/tast.fs), but I haven't the slightest idea what is causing it.
This started happening when I tried to upgrade my library project from .NET 5 to .NET 6, so the real answer to my question may be an explanation of what I did wrong there. All I did was the following:
In the fsproj, changed "TargetFramework" from "net5.0" to "net6.0"
In my paket.dependencies file, changed "framework" from "net5.0" to "net6.0". (I've also tried commenting out the "framework" line.)
Then after running "paket update" and "dotnet build" I get the obscure error. ("error FS0192 : internal error : No compiled representation for provided namespace")
UPDATE: After some laborious code commenting/uncommenting, etc., I believe I've narrowed this down to my code's use of the Fable.RegexProvider assembly. (I use the SafeRegex component.) RegexProvider hasn't been updated in a couple years. I'll alert the folks over there to this issue, and I'll post an update here if/when I learn anything. (In case anybody else runs into this.)
In case anyone else runs into this, here is the solution (which is the solution #CaringDev recommended above, though it only works for Fable 3.7.18 and after):
When I raised this issue on the Fable.RegexProvider github (see thread here: https://github.com/fable-compiler/Fable.RegexProvider/issues/9), the initial thought was to try a .NET 6 build of Fable.RegexProvider. But then Alfonso Garcia-Caro realized that subsequent improvements to Fable may have obviated the need for SafeRegex.
He ultimately needed to tweak something in Fable, but as of version 3.7.18, the Fable transpiler supports the use of FSharp.Text.RegexProvider, such that Fable.RegexProvider is now unnecessary.

Not being able to build F# type provider SDK

I have finally come across something that no one else seemed to have come across (at least from what I can tell). I trying to build an F# type provider using TypeProviders.SDK.
As soon as I build the solution I get the error: "FS0810, Property 'CultureName' cannot be set, \LemonadeProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs" on line 2090 and again at 3162 in the design time project of the solution.
I do not think this is useful but the Test project also fails as it can not find the LemonadeProvider.Runtime.dll. I am assuming this will get created when the Runtime project will build successfully.
PS: As of right now I am just tring to build the provided template, I have not changed the code or added anything to it. Hence I have not attached any code, but please feel free to ask for it.
The corresponding issue is https://github.com/fsprojects/FSharp.TypeProviders.SDK/issues/353
Known workarounds
Change minimum target to net461. Replace all instances of net45 with net461, except for in netfx.props, where you can just delete the lines referencing net45* frameworks (I suspect the removal of those lines isn't strictly speaking necessary).
I did this workaround but am now facing these kinds of errors: (like 2000 of them)
C:\Users\user\source\repos\HelloWorldProvider\paket-files\fsprojects\FSharp.TypeProviders.SDK\src\ProvidedTypes.fs(34,7): error FS0074: The type referenced through 'System.Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard'. [C:\Users\user\source\repos\HelloWorldProvider\src\HelloWorldProvider.DesignTime\HelloWorldProvider.DesignTime.fsproj]
I found out that the issue lied with the ProvidedTypes.fs and ProvidedTypes.fsi files created by the SDK.
The issue was solved for me when I replaced the files with the ones found in 'SDK-dsyme-patch-7' which provided compatibility for different .Net environments which was missing from the original SDK. There might be other differences but this is the one I found and it fixed the problem for me.
The files can be found under '/src/' in the dsyme patch.
The code I am referring to is as follows and has been added twice to the ProvidedTypes.fs:
#if NETSTANDARD
asmName.CultureName <- System.Globalization.CultureInfo.InvariantCulture.Name
#else
asmName.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture
#endif
asmName
I am not aware if there is a new SDK that has solved the problem. But at the time when the question was asked, this is what worked for me.

Unity3d: Error building Player: Append is not supported

I receive this error when appending an already-successful build in XCode. What I don't understand is I'm not changing anything when appending, and this error shows up.
I've never used an 'old version of Xcode' as the error implicitly states.
Does anyone know how to get append working on a consistent basis?
This is a very simple project, and I'm using Playhaven and TapForTap SDK's, if that offers any insight.
Turns out, XCode upgraded itself without telling me. :(
I rolled back to the version I was using and all is well.
With no code snippets or error logs, it's very hard to determine what the source of your problem is. There's no way to know if your error is describing the cause of your problem or a symptom of the problem without more information.
I can only offer some suggestions:
My first thought is that you're using a deprecated method in your code somewhere, possibly "Append", which if that is the case, more than likely has an updated counterpart, but you'll have to check documentation regarding that.
If you've used "Append" previously with no errors, then you should look into what exactly you've changed in your new build, and verify that the methods you're using are supported.
If your errors are vague or unhelpful, you can begin the process of elimination and start commenting out blocks of code until it builds successfully, and narrow down the source of the problem significantly.
However, it would be to your benefit to expand your question with more information.

Umbraco unit tests failing

I am trying to follow Jorge Lusar's suggestion on unit testing Umbraco. I could not get GetRoutingContext method to work because the Umbraco.Web.Routing.UrlProvider constructor is getting a null reference exception (I had downloaded an umbraco 7.0.4 installation previously and compiled the Umbraco.Tests.dll).
As I was getting out of options, I decided to download a fresh copy of Umbraco, compile and run a test that would execute the UrlProvider constructor. To my surprise, I got the null reference exception in there too so apparently, this bug has nothing to do with my solution but Umbraco's instead.
The images speak for themselves. Can anyone plase help with this? Is this really a bug or there's something I can do here?
The solution to the problem was to copy the config settings (the ones in the UnitTests project of the Umbraco solution) to my test project.
Umbraco is dependendant on config files. Not ideal for unit tests but it worked.
Here it is explained how to stub Umbraco dependencies.
Checking over a web.config for a current v7 site I've been working on, the umbracoConfiguration/settings section is of type Umbraco.Core.Configuration.UmbracoSettings.UmbracoSettingsSection.
Another thing you're doing wrong is using as IUmbracoSettingsSection. As means if the cast fails you return a null object, rather than an exception telling you the cast failed - it fails silently. It is better to do:
var umbracoSettings = (IUmbracoSettingsSection)ConfigurationManager.GetSection("umbracoConfiguration/settings");
As mentioned, I think your base type is wrong, and you should actually use:
var umbracoSettings = (Umbraco.Core.Configuration.UmbracoSettings.UmbracoSettingsSection)ConfigurationManager.GetSection("umbracoConfiguration/settings");
This should cast the section into the correct type for you.

missing NinjectDependancyResolver.cs

i'm working on a project that uses mvc in dotnet. i have to develop the remaining code given to me.I made a copy of the Maincode and tried to run it ;i'm getting this error when i tried to run with breakpoints.
This is the error i'm getting.
i googled and i got a answer saying to refresh the reference i did that too, but its not helping. what can be the problem.
this is the error i'm getting, a screen shot from web.
http://www.google.co.in/imgres?um=1&sa=N&hl=en&biw=1024&bih=621&tbm=isch&tbnid=MuZffsIBSR3nhM:&imgrefurl=https://stackoverflow.com/questions/8506618/no-source-available-error-with-ninject-when-debugging-code&docid=yGGstg8JC99hAM&imgurl=http://i.stack.imgur.com/nlWbT.png&w=1107&h=480&ei=GotmUf2yNYWKrgeam4DYBw&zoom=1&ved=1t:3588,r:3,s:0,i:91&iact=rc&dur=1437&page=1&tbnh=148&tbnw=341&start=0&ndsp=12&tx=91&ty=96
Are you sure your reference to Niniject in web project references is OK? Because it seems like author of the code used sources of ninject (placed in c:\projects\ninject\...) instead of library or nuget package (i dont know why). Try remove that reference and add Ninject as nuget package and see what happens.

Resources